/* Chat de leasing (src/_partes/chat.html + js/chat.js). Usa los tokens de site.css: azul de marca, Hanken
   Grotesk, itálica Newsreader. El botón vive en la esquina inferior derecha, la que la barra móvil deja libre. */
.htc { --htc-borde: var(--line-strong); font-family: var(--sans); color: var(--ink); }
.htc__vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Botón que abre */
.htc__abrir { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 95; display: inline-flex; align-items: center; gap: .5rem; min-height: 48px; padding: 0 1.1rem 0 .95rem; border: 1px solid var(--brand); border-radius: 999px; background: var(--brand); color: #fff; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); transition: background .2s, transform .2s var(--ease); }
.htc__abrir:hover { background: var(--brand-deep); }
.htc__abrir:active { transform: translateY(1px); }
.htc__abrir:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.htc[data-open='true'] .htc__abrir { display: none; }
/* Si el botón flotante queda encima de otro botón o campo de la página, se esconde (js/chat.js lo marca). */
.htc__abrir { transition: background .2s, transform .2s var(--ease), opacity .2s, visibility .2s; }
.htc[data-tapa='true'] .htc__abrir { opacity: 0; visibility: hidden; pointer-events: none; }
html[data-lb='1'] .htc { display: none; }   /* el lightbox de la galería ocupa toda la pantalla */

/* Panel */
.htc__panel { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 150; display: flex; flex-direction: column; width: min(392px, calc(100vw - 2.5rem)); height: min(640px, calc(100dvh - 2.5rem)); background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; opacity: 0; transform: translateY(12px); transition: opacity .25s, transform .35s var(--ease); }
.htc__panel[hidden] { display: none; }
.htc[data-open='true'] .htc__panel { opacity: 1; transform: none; }

.htc__cabeza { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem .75rem .9rem 1.15rem; border-bottom: 1px solid var(--line); }
.htc__titulo { margin: 0; font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.htc__titulo em { font-family: 'Newsreader', Georgia, serif; font-style: italic; font-weight: 400; font-size: 1.12em; color: var(--brand); }
.htc__sub { margin: .25rem 0 0; font-size: .8rem; color: var(--muted); }
.htc__cerrar { flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin-top: -.35rem; border: 0; border-radius: var(--radius); background: none; color: var(--ink); cursor: pointer; }
.htc__cerrar:hover { background: var(--band); }

.htc__demo { margin: 0; padding: .5rem 1.15rem; background: #fff4d6; color: #5c4300; font-size: .8rem; font-weight: 500; border-bottom: 1px solid rgba(92, 67, 0, .18); }

/* Conversación */
.htc__mensajes { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .6rem; padding: 1rem 1.15rem; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; }
.htc__mensajes:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.htc__burbuja { max-width: 86%; margin: 0; padding: .65rem .9rem; border-radius: 14px; border-bottom-left-radius: 4px; background: var(--band); font-size: .95rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.htc__burbuja a { color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.htc__burbuja--yo { align-self: flex-end; border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; background: var(--brand); color: #fff; }
.htc__burbuja--error { background: #fdecea; color: #7a1c12; }
.htc__burbuja--error button { display: block; margin-top: .5rem; min-height: 40px; padding: 0 .9rem; border: 1px solid currentColor; border-radius: var(--radius); background: none; color: inherit; font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; }

.htc__escribe { display: inline-flex; gap: 5px; align-items: center; min-height: 2.4rem; }
.htc__escribe i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: htc-punto 1.1s infinite ease-in-out; }
.htc__escribe i:nth-child(2) { animation-delay: .15s; }
.htc__escribe i:nth-child(3) { animation-delay: .3s; }
@keyframes htc-punto { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

/* Tarjeta del pedido: los datos que juntó el asistente, para revisar y mandar. */
.htc__tarjeta { display: grid; gap: .6rem; margin: .2rem 0; padding: .9rem; border: 1px solid var(--htc-borde); border-radius: 10px; background: var(--white); }
.htc__tarjeta h3 { margin: 0; font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); }
.htc__tarjeta label { display: grid; gap: .2rem; font-size: .75rem; font-weight: 600; color: var(--muted); }
.htc__tarjeta input, .htc__tarjeta select { min-height: 44px; width: 100%; padding: .45rem .65rem; border: 1px solid var(--htc-borde); border-radius: var(--radius); background: var(--white); color: var(--ink); font: inherit; font-size: 1rem; font-weight: 400; }
.htc__tarjeta input:focus-visible, .htc__tarjeta select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.htc__par { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.htc__nota { margin: 0; font-size: .8rem; line-height: 1.4; color: var(--muted); }
.htc__aviso { margin: 0; font-size: .85rem; font-weight: 500; color: #7a1c12; }
.htc__tarjeta .btn { width: 100%; }
.htc__estado { margin: .2rem 0; padding: .75rem .9rem; border-left: 3px solid var(--brand); background: var(--brand-soft); font-size: .9rem; line-height: 1.45; }

/* Atajos y caja de texto */
.htc__atajos { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 1.15rem .75rem; }
.htc__atajos[hidden] { display: none; }
.htc__atajos button { min-height: 40px; padding: 0 .85rem; border: 1px solid var(--htc-borde); border-radius: 999px; background: var(--white); color: var(--ink); font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer; transition: border-color .2s, background .2s; }
.htc__atajos button:hover { border-color: var(--brand); background: var(--brand-soft); }

.htc__form { display: flex; align-items: flex-end; gap: .5rem; padding: .75rem .75rem .5rem 1.15rem; border-top: 1px solid var(--line); }
.htc__form textarea { flex: 1; min-height: 46px; max-height: 7.5rem; padding: .65rem .8rem; border: 1px solid var(--htc-borde); border-radius: var(--radius); background: var(--white); color: var(--ink); font: inherit; font-size: 1rem; line-height: 1.4; resize: none; }
.htc__form textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.htc__enviar { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: var(--radius); background: var(--brand); color: #fff; cursor: pointer; transition: background .2s; }
.htc__enviar:hover { background: var(--brand-deep); }
.htc__enviar:disabled { background: var(--muted); cursor: default; }
.htc__pie { margin: 0; padding: 0 1.15rem .8rem; font-size: .75rem; line-height: 1.4; color: var(--muted); }
.htc__pie a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

/* Teléfono: el panel ocupa la pantalla y el botón se achica para entrar al lado de la barra de acciones. */
@media (max-width: 600px) {
  .htc__abrir { right: .75rem; padding: 0 .9rem 0 .8rem; font-size: .85rem; }
  .htc__panel { inset: 0; width: auto; height: 100dvh; border: 0; border-radius: 0; }
  html.htc-fijo, html.htc-fijo body { overflow: hidden; }
}
/* Teléfonos angostos: la barra (Call + Check availability) no entra al lado del botón con texto. El botón del
   chat queda solo con el ícono y la barra gana ese ancho. El nombre accesible lo sigue dando el span. */
@media (max-width: 400px) {
  .htc__abrir { width: 48px; padding: 0; justify-content: center; }
  .htc__abrir span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .bar { right: calc(.75rem + 48px + .6rem); }
}

@media (prefers-reduced-motion: reduce) {
  .htc__panel, .htc__abrir { transition: none; }
  .htc__mensajes { scroll-behavior: auto; }
  .htc__escribe i { animation: none; opacity: .6; }
}
html[data-motion='estatico'] .htc__panel, html[data-motion='estatico'] .htc__abrir { transition: none; }
html[data-motion='estatico'] .htc__escribe i { animation: none; opacity: .6; }
