[hidden] { display: none !important; }
/* Página del agente v5: la ventana es la protagonista. Poco texto, dos caminos claros. */
.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; }

.agent { width: min(100% - 32px, 860px); margin: 0 auto; padding-block: 36px 90px; display: grid; gap: 26px; }
.agent-intro { text-align: center; display: grid; gap: 10px; justify-items: center; }
.agent-intro h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); }
.agent-intro p { color: var(--ink-2); font-size: 1.15rem; max-width: 30em; }

/* Ventana */
.chat {
  position: relative; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; padding: 0; margin: 0;
  height: min(74vh, 700px); min-height: 520px; border-radius: 26px; overflow: hidden;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .06), 0 60px 100px -50px rgb(15 30 61 / .6), 0 0 0 1px rgb(15 30 61 / .06);
}
.chat::before { /* brillo naranja suave arriba: le da profundidad a la ventana */
  content: ""; position: absolute; inset: 0 0 auto; height: 260px; pointer-events: none;
  background: radial-gradient(60% 100% at 50% 0%, rgb(255 114 0 / .16), transparent 70%);
}
.chat-head { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.chat-av { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); flex: none; }
.chat-av svg { width: 28px; height: auto; fill: #fff; }
.chat-av::after { content: none; }   /* el "En línea" ya lleva su punto verde */
.chat-id b { display: block; font: 700 1.06rem var(--head); }
.chat-status { display: flex; align-items: center; gap: 7px; font-size: .86rem; color: var(--ink-2); }
.chat-wa { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px; text-decoration: none; font: 700 .92rem var(--head); color: var(--ink); border: 1px solid var(--line); transition: background-color .25s, border-color .25s; }
.chat-wa:hover { background: #1FA855; border-color: #1FA855; color: #fff; }
.chat-wa svg { width: 18px; height: 18px; }

.chat-progress { position: relative; display: grid; gap: 8px; padding: 12px 18px 0; font-size: .86rem; color: var(--ink-2); }
.chat-progress b { font-weight: 600; color: var(--ink); }
.chat-progress em { font-style: normal; }
.chat-progress i { display: block; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.chat-progress s { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .6s cubic-bezier(.16,1,.3,1); text-decoration: none; }

.chat-body { position: relative; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); }   /* la fila no crece con la bienvenida: así la conversación scrollea */
.chat-welcome { max-height: 100%; overflow-y: auto; scrollbar-width: none; }
.chat-log { grid-area: 1 / 1; overflow-y: auto; padding: 22px 18px 8px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; scrollbar-width: thin; }

/* Bienvenida (antes de escribir) */
.chat-welcome { grid-area: 1 / 1; z-index: 1; align-self: center; display: grid; gap: 22px; padding: 22px; justify-items: center; transition: opacity .35s ease, transform .5s cubic-bezier(.16,1,.3,1); }
.chat.started .chat-welcome { opacity: 0; transform: translateY(-16px); pointer-events: none; visibility: hidden; transition: opacity .3s ease, transform .5s cubic-bezier(.16,1,.3,1), visibility 0s .3s; }
.cw-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; width: 100%; max-width: 640px; }
.cw-mode {
  position: relative; isolation: isolate; overflow: hidden; display: grid; gap: 6px; text-align: left; cursor: pointer;
  padding: 22px 22px 24px; border-radius: 18px; border: 1px solid var(--line); background: rgb(255 255 255 / .04); color: var(--ink);
  transition: border-color .3s, transform .45s cubic-bezier(.16,1,.3,1), background-color .3s;
}
.cw-mode b { font: 700 1.18rem/1.2 var(--head); letter-spacing: -.01em; }
.cw-mode span { font-size: .95rem; color: var(--ink-2); }
.cw-mode:hover { transform: translateY(-3px); border-color: rgb(255 255 255 / .28); background: rgb(255 255 255 / .07); }
.cw-mode.demo { border-color: rgb(255 114 0 / .55); background: rgb(255 114 0 / .1); }
.cw-mode.demo::before { content: "1 minuto"; justify-self: start; margin-bottom: 4px; font: 700 .74rem var(--body); padding: 3px 9px; border-radius: 99px; background: var(--accent); color: #0F1E3D; }
.cw-mode.demo:hover { background: rgb(255 114 0 / .18); border-color: var(--accent); }
.cw-ex { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ex { cursor: pointer; padding: 8px 13px; border-radius: 99px; border: 1px solid var(--line); background: none; color: var(--ink-2); font: 500 .9rem var(--body); transition: color .2s, border-color .2s; }
.ex:hover { color: var(--ink); border-color: rgb(255 255 255 / .35); }

/* Mensajes */
.chat .msg { align-self: flex-start; max-width: min(84%, 560px); padding: 11px 14px 8px; border-radius: 6px 18px 18px 18px; background: rgb(255 255 255 / .07); border: 1px solid var(--line); animation: msgIn .45s cubic-bezier(.16,1,.3,1) both; }
.chat .msg p { font-size: 1rem; line-height: 1.5; white-space: pre-line; }
.chat .msg small { display: block; text-align: right; font-size: .72rem; color: var(--ink-2); margin-top: 3px; }
.chat .msg.me { align-self: flex-end; border-radius: 18px 6px 18px 18px; background: var(--accent); border-color: transparent; color: #0F1E3D; }
.chat .msg.me small { color: rgb(15 30 61 / .6); }
.chat .msg.typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.chat .msg.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-2); animation: dot 1.2s ease-in-out infinite; }
.chat .msg.typing i:nth-child(2) { animation-delay: .15s; }
.chat .msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes dot { 0%, 60%, 100% { transform: none; opacity: .45; } 30% { transform: translateY(-5px); opacity: 1; } }
.chat-wa-card { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; padding: 9px 14px; border-radius: 12px; background: #1FA855; color: #fff; text-decoration: none; font: 700 .92rem var(--head); }
.chat-wa-card svg { width: 16px; height: 16px; }

/* Resultado de la demo */
.res-card { display: grid; gap: 2px; min-width: min(460px, 70vw); }
.res-title { font: 700 1.1rem var(--head); margin-bottom: 8px; color: var(--accent-ink); }
.res-row { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); animation: msgIn .5s cubic-bezier(.16,1,.3,1) both; }
.res-row span { font-size: .88rem; color: var(--ink-2); }
.res-row b { font-weight: 600; font-size: .98rem; }

.chat-quick { position: relative; display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 18px 12px; min-height: 6px; }
.qr { cursor: pointer; padding: 9px 14px; border-radius: 99px; border: 1.5px solid rgb(255 114 0 / .6); background: transparent; color: var(--accent-ink); font: 700 .92rem var(--head); animation: msgIn .4s cubic-bezier(.16,1,.3,1) both; transition: background-color .25s, color .25s; }
.qr:hover { background: var(--accent); color: #0F1E3D; }

.chat-form { position: relative; display: flex; align-items: flex-end; gap: 10px; margin: 0 14px; padding: 8px 8px 8px 16px; border-radius: 16px; border: 1.5px solid var(--line); background: rgb(0 0 0 / .25); box-shadow: none; transition: border-color .25s; }
.chat-form:focus-within { border-color: var(--accent); }
.chat-form textarea { flex: 1; min-height: 24px; max-height: 140px; resize: none; border: 0; padding: 8px 0; background: transparent; outline: none; font: 400 1rem/1.4 var(--body); color: var(--ink); }
.chat-form textarea::placeholder { color: var(--ink-2); }
.chat-form textarea:focus { outline: none; }
.chat-send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--accent); color: #0F1E3D; cursor: pointer; transition: transform .25s, opacity .25s; }
.chat-send:hover { transform: translateX(2px); }
.chat-send:disabled { opacity: .5; cursor: default; }
.chat-send svg { width: 20px; height: 20px; }
.chat-legal { position: relative; padding: 10px 18px 14px; font-size: .78rem; color: var(--ink-2); }
.chat-legal a { color: inherit; }

/* el formulario del chat no lleva el estilo de tarjeta de los formularios del sitio */
.chat .chat-form { background: rgb(0 0 0 / .25); border-color: var(--line); box-shadow: none; }

@media (max-width: 700px) {
  .agent { width: 100%; padding: 12px 0 0; gap: 16px; }
  .agent-intro { padding: 0 20px; }
  .agent-intro h1 { font-size: 2.1rem; }
  .agent-intro p { font-size: 1.02rem; }
  .chat { border-radius: 0; border-inline: 0; height: calc(100dvh - 210px); min-height: 480px; }
  .cw-modes { grid-template-columns: 1fr; gap: 10px; }
  .cw-mode { padding: 18px 18px 20px; }
  .chat-wa span { display: none; }
  .chat-wa { width: 40px; padding: 0; justify-content: center; }
  .res-card { min-width: 0; }
  .res-row { grid-template-columns: 1fr; gap: 2px; }
  .chat .msg { max-width: 90%; }
  body[data-page="agente"] .wa-float, body[data-page="agente"] .site-footer { display: none; }
}
@media (prefers-reduced-motion: reduce) { .chat .msg, .qr, .res-row { animation: none; } .chat .msg.typing i { animation: none; } }
.chat-head { grid-row: 1; } .chat-progress { grid-row: 2; } .chat-body { grid-row: 3; } .chat-quick { grid-row: 4; } .chat-form { grid-row: 5; } .chat-legal { grid-row: 6; }
.cw-mode { align-content: start; }
