/* Charla · Moxen — los estilos del efecto y de la demostración. */
:root {
  --ch-fondo: #1e1e24;
  --ch-texto: #f3f5f8;
  --ch-suave: rgba(243, 245, 248, .6);
  --ch-tenue: rgba(243, 245, 248, .36);
  --ch-ventana: #1e1e24;
  --ch-linea: rgba(255, 255, 255, .07);
  --ch-borde: rgba(255, 255, 255, .13);
  --ch-encima: rgba(255, 255, 255, .06);
  --ch-relieve: rgba(255, 255, 255, .06);
  --ch-luz: rgba(255, 255, 255, .06);          /* el filo de arriba de cada capa */
  --ch-ellos: #2c2c35;                         /* la burbuja de soporte */
  --ch-ellos-tinta: #f4f4f4;
  --ch-tu: linear-gradient(180deg, #2f8bff, #1677f4);                            /* tu burbuja */
  --ch-tu-tinta: #ffffff;
  --ch-tu-suave: rgba(255, 255, 255, .72);
  --ch-control: #26262e;
  --ch-flota: #2a2a33;                         /* la barra de reacciones */
  --ch-boton: #1677f4;
  --ch-boton-tinta: #ffffff;
  --ch-apagado: rgba(255, 255, 255, .08);
  --ch-ok: #3ccf6e;
  --ch-mal: #ff5a4f;
  --ch-sombra: 0 40px 80px -40px rgba(0, 0, 0, .8), 0 16px 36px -24px rgba(0, 0, 0, .7);
  --ch-alzada: 0 14px 28px -12px rgba(22, 119, 244, .5), 0 4px 10px -4px rgba(0, 0, 0, .4);
  --ch-curva: cubic-bezier(.22, 1, .36, 1);
  --ch-rebote: cubic-bezier(.34, 1.56, .64, 1);
  --ch-radio: 20px;          /* el redondeo de las burbujas */
  --ch-junta: 6px;           /* el de las esquinas que se juntan dentro de un grupo */
  --ch-letra: 15px;          /* el campo, las fichas y las burbujas: las tres iguales, así el texto vuela sin cambiar de tamaño */
}
.ch-charla, .ch-charla *, .ch-vuelos, .ch-vuelos * { box-sizing: border-box; }
.ch-charla :where(button, textarea) { font: inherit; color: inherit; }
.ch-charla :where(svg) { display: block; }
.ch-charla svg, .ch-vuelos svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ch-charla :focus-visible { outline: 2px solid var(--ch-texto); outline-offset: 2px; }
.ch-charla [hidden] { display: none !important; }

/* ── la ventana ────────────────────────────────────────────────────── */
.ch-charla {
  position: relative; width: min(600px, 100%); height: min(740px, calc(100vh - 48px)); display: grid;
  grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden; border: 1px solid var(--ch-linea); border-radius: 28px; background: var(--ch-ventana);
  box-shadow: inset 0 1px 0 var(--ch-luz), var(--ch-sombra);
}

.ch-cabeza { position: relative; z-index: 2; display: flex; align-items: center; gap: 13px; height: 74px; padding: 0 14px 0 18px; border-bottom: 1px solid var(--ch-linea); }
.ch-avatar {
  position: relative; display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--ch-texto); color: var(--ch-ventana);
}
.ch-avatar svg { width: 22px; height: 22px; stroke-width: 1.8; }
/* en línea: un punto verde que respira */
.ch-estado { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; background: var(--ch-ok); box-shadow: 0 0 0 3px var(--ch-ventana); }
.ch-estado::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ch-ok); animation: ch-respira 2.4s var(--ch-curva) infinite; }
@keyframes ch-respira { 0% { transform: scale(1); opacity: .55; } 70%, 100% { transform: scale(2.3); opacity: 0; } }
.ch-quien { flex: 1; min-width: 0; }
.ch-quien h2 { margin: 0; font-size: 1.1rem; font-weight: 600; letter-spacing: -.025em; line-height: 1.2; }
.ch-sub { margin: 3px 0 0; font-size: .84rem; color: var(--ch-suave); }
/* el subtítulo cambia («En línea» ↔ «Escribiendo…») girando como un tambor */
.ch-rueda { display: grid; perspective: 300px; overflow: hidden; }
.ch-rueda > span { grid-area: 1 / 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform-origin: 50% 50% -.4em; }
.ch-rueda .is-entra { animation: ch-gira-entra .55s .06s var(--ch-curva) both; }
.ch-rueda .is-sale { animation: ch-gira-sale .24s cubic-bezier(.5, 0, .75, 0) forwards; }
@keyframes ch-gira-entra { from { transform: translateY(55%) rotateX(-80deg); opacity: 0; } }
@keyframes ch-gira-sale { to { transform: translateY(-55%) rotateX(80deg); opacity: 0; } }
.ch-nueva {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border: 1px solid var(--ch-linea); border-radius: 13px;
  background: none; cursor: pointer; transition: background-color .2s, transform .25s var(--ch-curva);
}
.ch-nueva svg { width: 19px; height: 19px; }
.ch-nueva:hover { background: var(--ch-encima); }
.ch-nueva:active { transform: scale(.94); }

/* el hilo: se desplaza solo, y los mensajes se deslizan bajo la cabecera con un degradado */
.ch-cuerpo { position: relative; min-height: 0; }
.ch-hilo {
  height: 100%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 0 18px 18px;
  scrollbar-width: thin; scrollbar-color: var(--ch-borde) transparent;
  -webkit-mask-image: linear-gradient(transparent, #000 18px); mask-image: linear-gradient(transparent, #000 18px);
}
.ch-pista { display: flex; flex-direction: column; }
.ch-intro { display: grid; justify-items: center; text-align: center; padding: 50px 24px 6px; }
.ch-sello {
  display: grid; place-items: center; width: 58px; height: 58px; border-radius: 19px;
  background: var(--ch-relieve); border: 1px solid var(--ch-linea); box-shadow: inset 0 1px 0 var(--ch-luz);
}
.ch-sello svg { width: 27px; height: 27px; stroke-width: 1.6; }
.ch-intro h3 { margin: 18px 0 0; font-size: 1.62rem; font-weight: 600; letter-spacing: -.04em; line-height: 1.1; }
.ch-intro p { margin: 9px 0 0; max-width: 330px; font-size: .9rem; line-height: 1.5; color: var(--ch-suave); }

.ch-log { display: flex; flex-direction: column; }
.ch-dia { display: flex; align-items: center; gap: 14px; margin: 26px 4px 4px; font-size: .76rem; font-weight: 500; color: var(--ch-tenue); }
.ch-dia::before, .ch-dia::after { content: ""; flex: 1; height: 1px; background: var(--ch-linea); }

/* ── los mensajes ──────────────────────────────────────────────────── */
/* Cada mensaje es una fila. Las seguidas del mismo remitente forman un
   grupo: el nombre va en la primera, el avatar, la hora y la cola de la
   burbuja solo en la última, y las esquinas que se tocan se achican. */
.ch-fila { display: grid; grid-template-columns: minmax(0, 1fr); margin-top: 3px; }
.ch-fila.is-primero { margin-top: 16px; }
.ch-fila[data-de="tu"] { justify-items: end; }
.ch-fila:not([data-de="tu"]) { grid-template-columns: 30px minmax(0, 1fr); column-gap: 9px; justify-items: start; }
.ch-nombre { grid-column: 2; grid-row: 1; margin: 0 0 5px 4px; font-size: .76rem; font-weight: 500; color: var(--ch-tenue); }
.ch-fila:not(.is-primero) .ch-nombre { display: none; }
.ch-av {
  grid-column: 1; grid-row: 2; align-self: end; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--ch-texto); color: var(--ch-ventana); font-size: .62rem; font-weight: 600; letter-spacing: .02em;
  opacity: 0; transform: scale(.6); transition: opacity .25s, transform .45s var(--ch-rebote);
}
.ch-av svg { width: 16px; height: 16px; stroke-width: 1.9; }
.ch-fila.is-ultimo .ch-av { opacity: 1; transform: none; }
.ch-msj {
  grid-row: 2; position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  max-width: min(100%, 420px); border-radius: var(--ch-radio); outline: none;
}
.ch-fila[data-de="tu"] .ch-msj { grid-column: 1; align-items: flex-end; }
.ch-fila:not([data-de="tu"]) .ch-msj { grid-column: 2; }
.ch-msj:focus-visible .ch-bloque { box-shadow: 0 0 0 2px var(--ch-ventana), 0 0 0 4px var(--ch-texto); }
.ch-meta {
  grid-row: 3; display: none; align-items: center; gap: 5px; margin: 5px 4px 0; font-size: .74rem; color: var(--ch-tenue);
  font-variant-numeric: tabular-nums;
}
.ch-fila:not([data-de="tu"]) .ch-meta { grid-column: 2; }
.ch-fila.is-ultimo .ch-meta { display: flex; }
/* con una reacción, la fila deja sitio a la píldora (el hilo se acomoda con su resorte) */
.ch-fila.is-ultimo.is-reac .ch-meta { margin-top: 18px; }
.ch-fila.is-reac:not(.is-ultimo) { padding-bottom: 15px; }

.ch-bloque {
  position: relative; border-radius: var(--ch-radio); background: var(--ch-ellos); color: var(--ch-ellos-tinta);
  box-shadow: inset 0 1px 0 var(--ch-luz); transition: border-radius .35s var(--ch-curva);
}
.ch-fila[data-de="tu"] .ch-bloque { background: var(--ch-tu); color: var(--ch-tu-tinta); box-shadow: 0 8px 18px -12px rgba(22, 119, 244, .55); }
.ch-burbuja { padding: 10px 15px; font-size: var(--ch-letra); line-height: 1.45; letter-spacing: -.003em; white-space: pre-wrap; overflow-wrap: anywhere; }
/* las esquinas que se juntan, del lado del remitente */
.ch-fila:not([data-de="tu"]) .ch-bloque:not(:first-of-type),
.ch-fila:not([data-de="tu"]):not(.is-primero) .ch-bloque:first-of-type { border-top-left-radius: var(--ch-junta); }
.ch-fila:not([data-de="tu"]) .ch-bloque:not(:last-of-type),
.ch-fila:not([data-de="tu"]):not(.is-ultimo) .ch-bloque:last-of-type { border-bottom-left-radius: var(--ch-junta); }
.ch-fila[data-de="tu"] .ch-bloque:not(:first-of-type),
.ch-fila[data-de="tu"]:not(.is-primero) .ch-bloque:first-of-type { border-top-right-radius: var(--ch-junta); }
.ch-fila[data-de="tu"] .ch-bloque:not(:last-of-type),
.ch-fila[data-de="tu"]:not(.is-ultimo) .ch-bloque:last-of-type { border-bottom-right-radius: var(--ch-junta); }
/* la cola: un trocito recortado con una curva (clip-path) que nace de la
   esquina de la última burbuja; la mitad queda dentro de la burbuja y
   tapa su esquina redonda, la otra mitad sale en punta */
.ch-burbuja::after {
  content: ""; position: absolute; bottom: 0; left: -7px; width: 15px; height: 19px; background: inherit; opacity: 0; transition: opacity .2s;
  clip-path: path('M15 0V19H1.2C4.4 17.8 6.6 14.3 7.1 7.5V0Z'); pointer-events: none;
}
.ch-fila[data-de="tu"] .ch-burbuja::after { left: auto; right: -7px; clip-path: path('M0 0V19H13.8C10.6 17.8 8.4 14.3 7.9 7.5V0Z'); }
.ch-fila.is-ultimo .ch-burbuja:last-of-type::after { opacity: 1; }

/* los avisos del sistema («… se unió a la conversación») */
.ch-sistema { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 18px 0 2px; font-size: .8rem; color: var(--ch-suave); }
.ch-sistema .ch-av { opacity: 1; transform: none; width: 22px; height: 22px; font-size: .5rem; }

/* ✓ enviado y ✓✓ leído: los dos se dibujan */
.ch-visto { width: 19px; height: 12px; }
.ch-visto path { stroke-width: 1.7; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .32s cubic-bezier(.65, 0, .35, 1), stroke .3s; }
.is-enviado .ch-visto path:first-child, .is-leido .ch-visto path { stroke-dashoffset: 0; }
.is-leido .ch-visto path { stroke: var(--ch-texto); }
.is-leido .ch-visto path:last-child { transition-delay: .06s, .1s; }

/* ── la tarjeta (respuesta rica) ───────────────────────────────────── */
.ch-tarjeta { width: 316px; max-width: 100%; padding: 16px 16px 14px; box-shadow: inset 0 1px 0 var(--ch-luz); }
.ch-t-cabeza { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .8rem; color: var(--ch-suave); font-variant-numeric: tabular-nums; }
.ch-t-estado {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px;
  background: var(--ch-relieve); border: 1px solid var(--ch-linea); color: var(--ch-texto); font-size: .74rem; font-weight: 500;
}
.ch-t-estado i { position: relative; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ch-t-estado i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: ch-respira 1.8s var(--ch-curva) infinite; }
.ch-t-titulo { margin: 14px 0 0; font-size: 1.5rem; font-weight: 600; letter-spacing: -.04em; line-height: 1.1; }
.ch-t-detalle { margin: 3px 0 0; font-size: .92rem; color: var(--ch-suave); }
.ch-t-pasos { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 4px; margin-top: 16px; }
.ch-t-pasos i { height: 4px; border-radius: 2px; background: var(--ch-linea); overflow: hidden; }
.ch-t-pasos b { display: block; height: 100%; border-radius: inherit; background: var(--ch-texto); transform: scaleX(0); transform-origin: 0 50%; }
.ch-t-pasos b.is-hecho { transform: none; }
.ch-t-pasos b.is-actual { transform: scaleX(.55); }
.ch-t-etapas { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 4px; margin-top: 7px; font-size: .7rem; color: var(--ch-tenue); }
.ch-t-etapas span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ch-t-etapas .is-actual { color: var(--ch-texto); font-weight: 500; }
.ch-t-filas { margin: 12px 0 0; display: grid; }
.ch-t-filas div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-top: 1px solid var(--ch-linea); font-size: .86rem; }
.ch-t-filas div:first-child { border-top: 0; }
.ch-t-filas dt { color: var(--ch-suave); font-variant-numeric: tabular-nums; }
.ch-t-filas dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.ch-t-pie { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ch-linea); font-size: .82rem; color: var(--ch-suave); }
.ch-t-accion {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--ch-boton); color: var(--ch-boton-tinta); font-size: .82rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: transform .25s var(--ch-curva), filter .2s;
}
.ch-t-accion svg { width: 15px; height: 15px; stroke-width: 2; transition: transform .3s var(--ch-curva); }
.ch-t-accion:hover svg { transform: translateX(2px); }
.ch-t-accion:active { transform: scale(.96); }

/* ── el archivo adjunto, con su avance ─────────────────────────────── */
.ch-archivo { display: flex; align-items: center; gap: 12px; width: 280px; max-width: 100%; padding: 10px 16px 10px 10px; }
.ch-arch-icono {
  position: relative; display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 13px;
  background: var(--ch-tu-suave); background: color-mix(in srgb, currentColor 9%, transparent); cursor: pointer;
}
.ch-arch-icono > svg { position: absolute; inset: 0; margin: auto; width: 21px; height: 21px; transition: opacity .25s, transform .4s var(--ch-rebote); }
.ch-arch-anillo { width: 44px !important; height: 44px !important; transform: rotate(-90deg); }
.ch-arch-anillo circle { stroke-width: 2.2; }
.ch-arch-anillo circle:first-child { opacity: .16; }
.ch-arch-anillo circle:last-child { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .3s var(--ch-curva); }
.ch-arch-cancela { opacity: 0; transform: scale(.5) !important; }
.ch-archivo.is-subiendo .ch-arch-doc { opacity: 0; transform: scale(.5); }
.ch-archivo.is-subiendo .ch-arch-cancela { opacity: 1; transform: none !important; }
.ch-archivo:not(.is-subiendo) .ch-arch-anillo { opacity: 0; transform: rotate(-90deg) scale(.8); }
.ch-archivo:not(.is-subiendo) .ch-arch-icono { cursor: default; }
.ch-arch-textos { min-width: 0; display: grid; gap: 2px; }
.ch-arch-textos b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .92rem; font-weight: 500; }
.ch-arch-textos small { font-size: .76rem; opacity: .6; font-variant-numeric: tabular-nums; }

/* ── «escribiendo…»: tres puntos en ola ────────────────────────────── */
.ch-escribe { display: grid; grid-template-columns: 30px auto; column-gap: 9px; justify-content: start; margin-top: 16px; }
.ch-escribe .ch-av { grid-row: 1; opacity: 1; transform: none; }
/* si sigue a un mensaje del mismo remitente, se pega a su grupo y no repite el avatar */
.ch-escribe.is-junta { margin-top: 6px; }
.ch-escribe.is-junta .ch-av { visibility: hidden; }
.ch-puntos {
  display: flex; align-items: center; gap: 5px; height: 42px; padding: 0 16px; border-radius: var(--ch-radio); border-bottom-left-radius: 4px;
  background: var(--ch-ellos); transform-origin: 0 100%;
}
.ch-puntos i { width: 7px; height: 7px; border-radius: 50%; background: var(--ch-ellos-tinta); opacity: .35; animation: ch-ola 1.15s ease-in-out infinite; }
.ch-puntos i:nth-child(2) { animation-delay: .14s; }
.ch-puntos i:nth-child(3) { animation-delay: .28s; }
@keyframes ch-ola { 0%, 56%, 100% { transform: none; opacity: .32; } 26% { transform: translateY(-5px); opacity: 1; } }

/* ── las respuestas rápidas ────────────────────────────────────────── */
.ch-fichas { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-left: 40px; }
.ch-ficha {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border: 1px solid var(--ch-borde); border-radius: 99px;
  background: var(--ch-ventana); color: var(--ch-texto); cursor: pointer; font-size: var(--ch-letra); line-height: 1.45; font-weight: 500; letter-spacing: -.005em;
  transition: background-color .2s, border-color .2s, transform .35s var(--ch-curva);
}
.ch-ficha:hover { background: var(--ch-encima); border-color: var(--ch-suave); transform: translateY(-2px); }
.ch-ficha:active { transform: scale(.97); }
.ch-ficha span { white-space: nowrap; }

/* ── lo que vuela: la ficha al campo y el texto del campo a su burbuja ── */
.ch-vuelos { position: fixed; inset: 0; z-index: 2147483001; pointer-events: none; }
.ch-vuelo { position: absolute; left: 0; top: 0; font-family: inherit; will-change: transform; }
.ch-vuelo-fondo { position: absolute; inset: 0; border-radius: inherit; }
.ch-vuelo[data-forma="ficha"] { border-radius: 99px; }
.ch-vuelo[data-forma="ficha"] .ch-vuelo-fondo { border: 1px solid var(--ch-borde); background: var(--ch-ventana); }
.ch-vuelo[data-forma="burbuja"] { border-radius: var(--ch-radio); border-bottom-right-radius: 4px; }
.ch-vuelo[data-forma="burbuja"] .ch-vuelo-fondo { background: var(--ch-tu); box-shadow: var(--ch-alzada); }
.ch-vuelo-texto { position: absolute; left: 0; top: 0; display: block; font-size: var(--ch-letra); line-height: 1.45; letter-spacing: -.003em; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ch-texto); }
.ch-vuelo[data-forma="ficha"] .ch-vuelo-texto { font-weight: 500; letter-spacing: -.005em; white-space: nowrap; }
.ch-vuelo-texto.is-tinta { color: var(--ch-tu-tinta); }
.ch-vuelo-icono { position: absolute; left: 0; top: 0; width: 20px; height: 20px; color: var(--ch-texto); }

/* ── las reacciones ────────────────────────────────────────────────── */
.ch-reacciones {
  position: absolute; left: 0; top: 0; z-index: 5; display: flex; gap: 2px; padding: 5px; border-radius: 99px;
  background: var(--ch-flota); border: 1px solid var(--ch-borde); box-shadow: var(--ch-alzada), inset 0 1px 0 var(--ch-luz);
  transform-origin: var(--ch-origen, 0 100%); opacity: 0; visibility: hidden; transform: scale(.6) translateY(6px);
  transition: opacity .16s, transform .2s var(--ch-curva), visibility 0s .2s;
}
.ch-reacciones.is-abierta { opacity: 1; visibility: visible; transform: none; transition: opacity .18s, transform .5s var(--ch-muelle, var(--ch-rebote)), visibility 0s; }
.ch-reacciones button {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
  opacity: 0; transform: translateY(8px) scale(.6); transition: opacity .15s, transform .2s var(--ch-curva), background-color .2s;
}
.ch-reacciones.is-abierta button { opacity: 1; transform: none; transition: opacity .2s calc(.04s + var(--i) * .035s), transform .45s calc(.04s + var(--i) * .035s) var(--ch-rebote), background-color .2s; }
.ch-reacciones button svg { width: 21px; height: 21px; transition: transform .3s var(--ch-rebote); }
.ch-reacciones button:hover svg, .ch-reacciones button:focus-visible svg { transform: translateY(-3px) scale(1.24); }
.ch-reacciones button[aria-pressed="true"] { background: var(--ch-relieve); }
.ch-reacciones button:focus-visible { outline-offset: -2px; }
/* la que queda en la burbuja: una píldora que se posa en su esquina */
.ch-reac {
  position: absolute; bottom: -15px; right: 10px; z-index: 1; display: grid; place-items: center; width: 30px; height: 24px; border-radius: 99px;
  background: var(--ch-flota); border: 1px solid var(--ch-borde); box-shadow: 0 0 0 2px var(--ch-ventana); color: var(--ch-texto);
}
.ch-fila[data-de="tu"] .ch-reac { right: auto; left: 10px; }
.ch-reac svg { width: 15px; height: 15px; stroke-width: 1.9; }
.ch-reac svg .ch-lleno { fill: currentColor; }
.ch-reac::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; border: 1.5px solid var(--ch-texto); opacity: 0; }
.ch-reac.is-posa::after { animation: ch-onda .7s var(--ch-curva); }
@keyframes ch-onda { from { opacity: .7; transform: scale(.8); } to { opacity: 0; transform: scale(1.9); } }

/* ── el campo ──────────────────────────────────────────────────────── */
.ch-redacta { position: relative; z-index: 2; padding: 12px 14px 14px; border-top: 1px solid var(--ch-linea); background: var(--ch-ventana); }
.ch-campo {
  display: flex; align-items: flex-end; gap: 4px; padding: 5px; border: 1px solid var(--ch-borde); border-radius: 25px; background: var(--ch-control);
  transition: border-color .25s, box-shadow .25s;
}
.ch-campo:focus-within { border-color: var(--ch-suave); box-shadow: 0 0 0 4px var(--ch-linea); }
.ch-campo textarea {
  flex: 1; min-width: 0; height: 40px; max-height: 136px; margin: 0; padding: 9px 6px; border: 0; outline: 0 !important; resize: none; background: none;
  font-size: var(--ch-letra); line-height: 1.45; letter-spacing: -.003em; color: var(--ch-texto); overflow-y: hidden; scrollbar-width: thin;
}
.ch-campo textarea::placeholder { color: var(--ch-tenue); transition: opacity .2s; }
/* mientras un texto vuela hacia el campo (o sale de él), el «Escribe un mensaje…» se aparta */
.ch-campo.is-callado textarea::placeholder { opacity: 0; transition-duration: .08s; }
.ch-adjunta, .ch-envia {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  transition: background-color .25s, color .25s, transform .4s var(--ch-rebote);
}
.ch-adjunta { background: none; color: var(--ch-suave); }
.ch-adjunta:hover { color: var(--ch-texto); background: var(--ch-encima); }
.ch-adjunta svg { width: 21px; height: 21px; }
.ch-envia { background: var(--ch-boton); color: var(--ch-boton-tinta); }
.ch-envia svg { width: 20px; height: 20px; stroke-width: 2.1; transition: transform .35s var(--ch-rebote); }
.ch-envia:disabled { background: var(--ch-apagado); color: var(--ch-tenue); cursor: default; transform: scale(.9); }
.ch-envia:disabled svg { transform: translateY(2px); }
.ch-envia:not(:disabled):hover svg { transform: translateY(-2px); }
.ch-envia.is-sale svg { animation: ch-despega .5s var(--ch-curva); }
@keyframes ch-despega { 40% { transform: translateY(-16px); opacity: 0; } 41% { transform: translateY(14px); opacity: 0; } }

/* «Nuevo mensaje»: aparece si llega algo y estás leyendo más arriba */
.ch-abajo {
  position: absolute; left: 50%; bottom: 12px; z-index: 3; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px 0 11px;
  border: 1px solid var(--ch-borde); border-radius: 99px; background: var(--ch-flota); box-shadow: var(--ch-alzada); cursor: pointer;
  font-size: .82rem; font-weight: 500; opacity: 0; visibility: hidden; transform: translate(-50%, 10px) scale(.9);
  transition: opacity .2s, transform .3s var(--ch-curva), visibility 0s .3s;
}
.ch-abajo svg { width: 16px; height: 16px; stroke-width: 2; }
.ch-abajo.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity .2s, transform .5s var(--ch-rebote), visibility 0s; }

/* soltar un archivo encima de la ventana */
.ch-suelta {
  position: absolute; inset: 10px; z-index: 8; display: grid; place-content: center; justify-items: center; gap: 12px; border-radius: 22px;
  border: 1.5px dashed var(--ch-suave); background: color-mix(in srgb, var(--ch-ventana) 88%, transparent); font-size: 1rem; font-weight: 500;
  opacity: 0; visibility: hidden; transform: scale(.98); transition: opacity .2s, transform .35s var(--ch-curva), visibility 0s .2s; pointer-events: none;
}
.ch-suelta svg { width: 30px; height: 30px; }
.ch-charla.is-arrastra .ch-suelta { opacity: 1; visibility: visible; transform: none; transition: opacity .2s, transform .35s var(--ch-curva), visibility 0s; }

.ch-oculto { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── en el teléfono: la ventana ocupa la pantalla ──────────────────── */
@media (max-width: 560px) {
  .ch-charla { width: 100%; height: min(680px, calc(100dvh - 120px)); min-height: 460px; border-radius: 22px; }
  .ch-cabeza { height: 66px; padding: 0 10px 0 14px; }
  .ch-avatar { width: 40px; height: 40px; }
  .ch-hilo { padding: 0 12px 16px; }
  .ch-intro { padding: 26px 12px 2px; }
  .ch-intro h3 { font-size: 1.42rem; }
  .ch-fila:not([data-de="tu"]) { grid-template-columns: 28px minmax(0, 1fr); column-gap: 8px; }
  .ch-av { width: 28px; height: 28px; }
  .ch-msj { max-width: min(100%, 300px); }
  .ch-fila[data-de="tu"] .ch-msj { max-width: 84%; }
  /* las fichas, en una fila que se desliza de lado (con el borde que se desvanece) */
  .ch-fichas {
    flex-wrap: nowrap; justify-content: flex-start; gap: 7px; margin-left: -12px; margin-right: -12px; padding: 2px 12px 4px;
    overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 28px), transparent);
  }
  .ch-fichas::-webkit-scrollbar { display: none; }
  .ch-ficha { flex: none; height: 38px; padding: 0 14px; }
  .ch-redacta { padding: 10px 10px 12px; }
}
@media (hover: none) {
  .ch-msj { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ch-estado::after, .ch-t-estado i::after { animation: none; opacity: 0; }
  .ch-puntos i { animation: none; opacity: .6; }
  .ch-rueda .is-entra { animation: ch-funde .15s both; }
  .ch-rueda .is-sale { animation: ch-funde .1s reverse forwards; }
  .ch-reacciones, .ch-reacciones.is-abierta, .ch-reacciones button, .ch-reacciones.is-abierta button { transition: opacity .12s, visibility 0s; transform: none; }
  .ch-visto path, .ch-arch-anillo circle:last-child { transition: none; }
  .ch-reac.is-posa::after, .ch-envia.is-sale svg { animation: none; }
  .ch-av, .ch-bloque { transition: none; }
}
@keyframes ch-funde { from { opacity: 0; } }

/* ── no site da REPO/STORE ─────────────────────────────────────────── */
.ch-charla { margin: 1.4rem auto; color: var(--ch-texto); font-family: inherit; text-align: left; }
.ch-charla h2, .ch-charla h3, .ch-charla p { font-family: inherit; text-transform: none; color: inherit; }
.ch-intro h3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font-size: 1.45rem; }
.ch-intro p { max-width: 370px; color: var(--ch-suave); }
.ch-t a { color: inherit; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.ch-fila.is-error .ch-meta { color: var(--ch-mal); }
.ch-fila.is-error .ch-visto { display: none; }
.ch-ficha--accion { border-color: var(--ch-suave); }
.ch-ficha--accion::before { content: "★"; margin-right: 8px; color: #f5b83d; }

/* ── a folha "Avaliar vendedor": sobe de baixo dentro da janela ────── */
.ch-hoja { position: absolute; inset: 0; z-index: 12; display: flex; align-items: flex-end; }
.ch-hoja[hidden] { display: none; }
.ch-hoja-fondo { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.ch-hoja-panel {
  position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; max-height: 100%; overflow-y: auto; padding: 22px 20px 20px;
  border-radius: 26px 26px 0 0; background: var(--ch-ventana); border-top: 1px solid var(--ch-borde); box-shadow: inset 0 1px 0 var(--ch-luz), 0 -30px 60px -20px rgba(0, 0, 0, .8);
  outline: none; text-align: center; scrollbar-width: thin;
}
.ch-hoja.is-saliendo .ch-hoja-panel { transform: translateY(100%); transition: transform .26s cubic-bezier(.5, 0, .75, 0); }
.ch-hoja.is-saliendo .ch-hoja-fondo { opacity: 0; transition: opacity .26s; }
.ch-hoja-cerrar { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--ch-linea); border-radius: 12px; background: none; cursor: pointer; }
.ch-hoja-cerrar svg { width: 18px; height: 18px; }
.ch-hoja-cerrar:hover { background: var(--ch-encima); }
.ch-hoja-avatar { position: relative; display: grid; place-items: center; flex: none; width: 96px; height: 96px; }
.ch-hoja-cara { display: grid; place-items: center; width: 80px; height: 80px; overflow: hidden; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #3a3a3a, #1c1c1c); box-shadow: 0 0 0 4px var(--ch-ventana), inset 0 1px 0 rgba(255, 255, 255, .12); font-size: 1.5rem; font-weight: 600; letter-spacing: .02em; color: #f4f4f4; }
.ch-hoja-cara img { width: 100%; height: 100%; object-fit: cover; }
.ch-hoja-anillo { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ch-hoja-anillo circle { fill: none; stroke: var(--ch-texto); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .9s cubic-bezier(.65, 0, .35, 1); }
.ch-hoja-avatar.is-sigue .ch-hoja-anillo circle { stroke-dashoffset: 0; }
.ch-hoja-avatar.is-sigue .ch-hoja-anillo { animation: ch-hoja-gira 1.4s cubic-bezier(.22, 1, .36, 1); }
@keyframes ch-hoja-gira { from { transform: rotate(-270deg); } to { transform: rotate(-90deg); } }
.ch-hoja-chispa { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: var(--ch-texto); pointer-events: none; }
.ch-hoja-nombre { margin: 12px 0 0; font-size: 1.35rem; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; overflow-wrap: anywhere; }
.ch-hoja-sub { margin: 5px 0 0; font-size: .88rem; color: var(--ch-suave); }
/* Três colunas iguais; em cada uma o número fica numa linha de altura fixa e o rótulo logo abaixo, então tudo alinha mesmo quando um rótulo quebra em duas linhas. */
.ch-hoja-metricas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-self: stretch; margin: 16px 0 0; padding: 14px 0; border-top: 1px solid var(--ch-linea); border-bottom: 1px solid var(--ch-linea); }
.ch-hoja-metricas div { display: grid; grid-template-areas: "numero" "rotulo"; grid-template-rows: auto auto; row-gap: 6px; justify-items: center; align-content: start; padding: 0 4px; text-align: center; }
.ch-hoja-metricas div + div { border-left: 1px solid var(--ch-linea); }
.ch-hoja-metricas dt { grid-area: rotulo; font-size: .72rem; line-height: 1.25; color: var(--ch-suave); }
.ch-hoja-metricas dd { grid-area: numero; display: flex; justify-content: center; align-items: flex-start; height: 1.2em; margin: 0; font-size: 1.55rem; line-height: 1.2; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ch-hoja-cuenta { display: inline-flex; align-items: flex-start; height: 1.2em; overflow: hidden; font-variant-numeric: tabular-nums; }
.ch-hoja-columna { display: flex; flex-direction: column; text-align: center; transition: transform .9s cubic-bezier(.22, 1, .36, 1); }
.ch-hoja-columna > span, .ch-hoja-signo { height: 1.2em; line-height: 1.2; }
.ch-hoja-estrellas { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.ch-hoja-estrella { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: none; cursor: pointer; color: var(--ch-tenue); transition: transform .3s var(--ch-rebote), color .2s; }
.ch-hoja-estrella svg { width: 32px; height: 32px; stroke-width: 1.5; fill: none; transition: fill .2s, stroke .2s; }
.ch-hoja-estrella:hover { transform: scale(1.12); }
.ch-hoja-estrella.is-on { color: #f5b83d; }
.ch-hoja-estrella.is-on svg { fill: #f5b83d; stroke: #f5b83d; }
.ch-hoja-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.ch-hoja-chip { height: 36px; padding: 0 14px; border: 1px solid var(--ch-borde); border-radius: 99px; background: none; cursor: pointer; font-size: .86rem; font-weight: 500; transition: background-color .2s, border-color .2s, color .2s; }
.ch-hoja-chip:hover { background: var(--ch-encima); }
.ch-hoja-chip[aria-pressed="true"] { background: var(--ch-boton); border-color: var(--ch-boton); color: var(--ch-boton-tinta); }
.ch-hoja-texto { align-self: stretch; min-height: 64px; margin-top: 14px; padding: 10px 14px; border: 1px solid var(--ch-borde); border-radius: 16px; background: var(--ch-control); resize: none; font-size: .9rem; line-height: 1.45; outline: none; }
.ch-hoja-texto:focus { border-color: var(--ch-suave); box-shadow: 0 0 0 4px var(--ch-linea); }
.ch-hoja-texto::placeholder { color: var(--ch-tenue); }
.ch-hoja-error { margin: 10px 0 0; font-size: .82rem; font-weight: 600; color: var(--ch-mal); }
.ch-hoja-error[hidden] { display: none; }
.ch-hoja-boton { position: relative; display: grid; place-items: center; overflow: hidden; align-self: stretch; height: 52px; margin-top: 16px; padding: 0; border: 0; border-radius: 99px; background: none; cursor: pointer; font-size: 1.02rem; font-weight: 600; color: var(--ch-boton-tinta); transition: color .35s; }
.ch-hoja-boton:disabled { cursor: default; }
.ch-hoja-fondoboton { position: absolute; inset: 0; border-radius: inherit; background: var(--ch-boton); transition: opacity .35s; }
.ch-hoja-boton::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1.5px var(--ch-borde); opacity: 0; transition: opacity .35s; }
.ch-hoja-boton.is-sigue { color: var(--ch-texto); }
.ch-hoja-boton.is-sigue .ch-hoja-fondoboton { opacity: 0; }
.ch-hoja-boton.is-sigue::after { opacity: 1; }
.ch-hoja-cara-b { grid-area: 1 / 1; position: relative; display: inline-flex; align-items: center; gap: 8px; transition: transform .55s cubic-bezier(.22, 1, .36, 1), opacity .3s; }
.ch-hoja-cara-b svg { width: 18px; height: 18px; stroke-width: 2.4; }
.ch-hoja-despues { transform: translateY(110%); opacity: 0; }
.ch-hoja-despues path { stroke: var(--ch-ok); stroke-dasharray: 22; stroke-dashoffset: 22; transition: stroke-dashoffset .45s .2s cubic-bezier(.22, 1, .36, 1); }
.ch-hoja-boton.is-sigue .ch-hoja-antes { transform: translateY(-110%); opacity: 0; }
.ch-hoja-boton.is-sigue .ch-hoja-despues { transform: none; opacity: 1; transition-delay: .06s; }
.ch-hoja-boton.is-sigue .ch-hoja-despues path { stroke-dashoffset: 0; }
@media (prefers-reduced-motion: reduce) {
  .ch-hoja-columna, .ch-hoja-anillo circle, .ch-hoja-cara-b, .ch-hoja-despues path, .ch-hoja-fondoboton { transition: none; }
  .ch-hoja-avatar.is-sigue .ch-hoja-anillo { animation: none; }
}

/* ── chat em tela cheia: só ele na tela ───────────────────────────── */
[data-order-chat]:not(.ch-pagina) { display: none; }
.ch-volver { display: none; }
.ch-pagina { position: fixed; inset: 0; z-index: 2147483000; display: grid; place-items: center; background: #1e1e24; }
.ch-pagina .ch-charla { width: 100%; max-width: 820px; height: 100dvh; min-height: 0; margin: 0; border-radius: 0; }
.ch-pagina .ch-volver { display: grid; place-items: center; flex: none; width: 38px; height: 38px; margin-left: -4px; padding: 0; border: 0; border-radius: 12px; background: none; cursor: pointer; }
.ch-pagina .ch-volver svg { width: 22px; height: 22px; stroke-width: 2; }
.ch-pagina .ch-volver:hover { background: var(--ch-encima); }
@media (min-width: 821px) { .ch-pagina .ch-charla { height: min(100dvh, 900px); border-radius: 22px; } }
html.ch-aberto:has(.ch-pagina), html.ch-aberto:has(.ch-pagina) body { overflow: hidden; }
.ch-sello { overflow: hidden; }
.ch-sello--foto { padding: 0; }
.ch-sello img { width: 100%; height: 100%; object-fit: cover; }
.ch-sello--foto img + svg { display: none; }
.ch-auto { display: block; margin-bottom: 3px; font-size: .68rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; opacity: .6; }

/* No computador o chat abre dentro da conta (menu e topo visíveis), não por cima de tudo. */
@media (min-width: 901px) {
  .pd2 .ch-pagina { position: relative; inset: auto; z-index: auto; display: block; background: none; }
  .pd2 .ch-pagina .ch-charla { max-width: none; height: calc(100dvh - 215px); min-height: 400px; border-radius: 12px; }
}
/* Rótulos das métricas numa linha só quando a folha tem largura para isso; em telas estreitas quebram, mas os números seguem alinhados. */
@media (min-width: 400px) { .ch-hoja-metricas dt { white-space: nowrap; } }

/* ── faixa de "bolinhas" (estilo Instagram) + animação de abertura ───────────── */
.ch-rail { display: none; }
.ch-bub { position: relative; display: grid; place-items: center; flex: none; width: 48px; height: 48px; box-sizing: border-box; border-radius: 50%; background: #1e1e24; color: #fff; font-size: .82rem; font-weight: 600; letter-spacing: .02em; line-height: 1; text-decoration: none; transition: transform .2s ease, box-shadow .2s ease; }
.ch-bub svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ch-bub.is-active { box-shadow: 0 0 0 3px var(--a-bg, #f3f6fb), 0 0 0 5px #3b82f6; }
a.ch-bub:hover { transform: scale(1.08); }
.ch-landing .ch-rail .ch-bub { visibility: hidden; }
.ch-fly { position: fixed; z-index: 2147483001; display: grid; place-items: center; overflow: hidden; box-sizing: border-box; pointer-events: none; background: #fff; border: 1px solid #e6ebf3; border-radius: 16px; color: #fff; }
.ch-fly b { display: grid; place-items: center; font-size: .82rem; font-weight: 600; opacity: 0; animation: ch-fly-face .35s .22s ease forwards; }
.ch-fly b svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
@keyframes ch-fly-face { to { opacity: 1; } }
html[data-theme="dark"] .ch-fly { background: #141a21; border-color: #222c36; }
html[data-theme="dark"] .ch-bub.is-active { box-shadow: 0 0 0 3px #0e1318, 0 0 0 5px #3b82f6; }
@media (min-width: 901px) {
  .seller-sale-detail .ch-pagina, .pd2 .ch-pagina { position: relative; inset: auto; z-index: auto; display: flex; align-items: flex-start; gap: 16px; background: none; }
  .ch-pagina .ch-rail { display: flex; flex-direction: column; align-items: center; gap: 12px; flex: none; width: 56px; padding-top: 6px; }
  .seller-sale-detail .ch-pagina .ch-charla, .pd2 .ch-pagina .ch-charla { flex: 1 1 0; min-width: 0; max-width: none; height: calc(100dvh - 215px); min-height: 400px; border-radius: 12px; }
  .seller-sale-detail:has(.ch-pagina) { padding: 0; border: 0; background: none; box-shadow: none; }
  .seller-sale-detail:has(.ch-pagina) > :not([data-order-chat]) { display: none; }
}
@media (prefers-reduced-motion: reduce) { .ch-fly { display: none; } }

/* Chat do pedido no tema claro (o padrão da plataforma); o escuro continua escuro. */
html:not([data-theme="dark"]) [data-order-chat] {
  --ch-fondo: #f3f6fb; --ch-texto: #17233d; --ch-suave: rgba(23, 35, 61, .62); --ch-tenue: rgba(23, 35, 61, .4);
  --ch-ventana: #ffffff; --ch-linea: #e6ebf3; --ch-borde: #d9e1ee; --ch-encima: rgba(23, 35, 61, .05); --ch-relieve: rgba(23, 35, 61, .05);
  --ch-luz: rgba(255, 255, 255, .9); --ch-ellos: #eef2f8; --ch-ellos-tinta: #17233d; --ch-control: #f1f4f9; --ch-flota: #ffffff;
  --ch-apagado: rgba(23, 35, 61, .07);
  --ch-sombra: 0 22px 44px -28px rgba(23, 35, 61, .3), 0 8px 20px -14px rgba(23, 35, 61, .18);
}
html:not([data-theme="dark"]) .ch-pagina { background: #f3f6fb; }
html:not([data-theme="dark"]) .ch-bub { background: #e8efff; color: #1d5cff; }
html:not([data-theme="dark"]) .ch-bub.is-active { background: #1d5cff; color: #fff; }

/* Botão Voltar visível (seta + texto) quando o chat está aberto */
.ch-volver__txt { display: none; }
.ch-pagina .ch-volver { width: auto; min-width: 38px; padding: 0 12px 0 6px; display: inline-flex; align-items: center; gap: 2px; font: inherit; color: inherit; }
.ch-pagina .ch-volver__txt { display: inline; font-size: .86rem; font-weight: 600; }
@media (min-width: 901px) { html:not([data-theme="dark"]) .seller-sale-detail .ch-pagina, html:not([data-theme="dark"]) .pd2 .ch-pagina { background: none; } }

/* Chat do pedido: sem a "pontinha" do balão (o degradê da bolha não casava com ela e parecia sobreposta) */
[data-order-chat] .ch-burbuja::after { display: none; }

/* Celular: campo com 16px, senão o iPhone dá zoom ao tocar para digitar (e a tela fica solta para os lados) */
@media (max-width: 900px) {
  :root, [data-order-chat], .ch-charla { --ch-letra: 16px; }
  .ch-campo textarea { font-size: 16px; }
  .ch-pagina, .ch-charla { max-width: 100vw; overflow-x: hidden; }
}

/* ══ Fase 2 · chat do pedido no padrão atual (tokens --rs-*, mesmo desenho de Vendas / Meus produtos) ══════════════ */
html:root [data-order-chat][data-order-chat] {
  --ch-fondo: var(--rs-subtle); --ch-texto: var(--rs-ink); --ch-suave: var(--rs-text); --ch-tenue: var(--rs-muted);
  --ch-ventana: var(--rs-surface); --ch-linea: var(--rs-edge); --ch-borde: var(--rs-edge); --ch-encima: var(--rs-subtle); --ch-relieve: var(--rs-subtle);
  --ch-luz: transparent; --ch-ellos: var(--rs-subtle); --ch-ellos-tinta: var(--rs-ink); --ch-control: var(--rs-surface); --ch-flota: var(--rs-surface);
  --ch-tu: var(--rs-primary-soft); --ch-tu-tinta: var(--rs-ink); --ch-tu-suave: var(--rs-text);
  --ch-boton: var(--rs-primary); --ch-boton-tinta: #fff; --ch-apagado: var(--rs-subtle);
  --ch-ok: var(--rs-ok); --ch-mal: var(--rs-danger);
  --ch-sombra: none; --ch-alzada: 0 4px 14px -6px rgba(28, 36, 48, .3);
  --ch-radio: 12px; --ch-junta: 4px; --ch-letra: 15px;
}
html:root .ch-pagina { background: var(--rs-subtle); }
html:root .ch-pagina .ch-charla { border-radius: 0; }
html:root .ch-charla { border: 1.5px solid var(--rs-edge); border-radius: 14px; box-shadow: none; }
@media (min-width: 821px) { html:root .ch-pagina .ch-charla { border-radius: 14px; } }
@media (min-width: 901px) { html:root .pd2 .ch-pagina .ch-charla, html:root .seller-sale-detail .ch-pagina .ch-charla { border-radius: 14px; } }
@media (max-width: 560px) { html:root .ch-charla { border-radius: 14px; } html:root .ch-pagina .ch-charla { border-radius: 0; border-width: 0; } }

/* cabeçalho: produto, pedido e situação */
html:root .ch-cabeza { height: auto; min-height: 64px; gap: 12px; padding: 10px 16px 10px 10px; background: var(--rs-surface); border-bottom: 1.5px solid var(--rs-edge); }
html:root .ch-avatar { width: 40px; height: 40px; border-radius: 10px; background: var(--rs-primary-soft); color: var(--rs-primary); border: 1px solid var(--rs-primary-edge); }
html:root .ch-estado { display: none; }
html:root .ch-quien h2 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 1rem; font-weight: 700; letter-spacing: 0; line-height: 1.25; color: var(--rs-ink); }
html:root .ch-sub { margin: 2px 0 0; font-size: .84rem; font-weight: 500; color: var(--rs-text); }
html:root .ch-status { flex: none; padding: 4px 10px; border-radius: 6px; background: var(--rs-ok-soft); color: var(--rs-ok); border: 1px solid var(--rs-ok-edge); font-size: .78rem; font-weight: 700; line-height: 1.2; }
html:root .ch-status.is-closed { background: var(--rs-subtle); color: var(--rs-text); border-color: var(--rs-edge); }
html:root .ch-pagina .ch-volver { height: 40px; border-radius: 10px; color: var(--rs-ink); }
html:root .ch-pagina .ch-volver:hover { background: var(--rs-subtle); }
html:root .ch-pagina .ch-volver__txt { font-size: .9rem; font-weight: 700; }

/* corpo: coluna confortável, aviso discreto no topo */
html:root .ch-cuerpo { background: var(--rs-surface); }
html:root .ch-hilo { padding: 0 20px 20px; }
html:root .ch-pista { width: 100%; max-width: 760px; margin: 0 auto; }
html:root .ch-intro { display: block; padding: 16px 0 4px; text-align: left; }
html:root .ch-intro .ch-sello, html:root .ch-intro h3 { display: none; }
html:root .ch-intro p { max-width: none; margin: 0; padding: 10px 12px; border: 1px solid var(--rs-edge); border-radius: 10px; background: var(--rs-subtle); font-size: .84rem; line-height: 1.5; color: var(--rs-text); }
html:root .ch-dia { margin: 22px 0 6px; font-size: .78rem; font-weight: 600; color: var(--rs-muted); }

/* mensagens: ~70% da coluna, mesmo corpo de letra */
html:root .ch-fila { margin-top: 4px; }
html:root .ch-fila.is-primero { margin-top: 14px; }
html:root .ch-msj, html:root .ch-fila[data-de="tu"] .ch-msj { max-width: 70%; }
html:root .ch-fila:has(.ch-entrega) .ch-msj { max-width: min(100%, 560px); }
html:root .ch-fila:not([data-de="tu"]) { grid-template-columns: 32px minmax(0, 1fr); column-gap: 10px; }
html:root .ch-av { width: 32px; height: 32px; border-radius: 10px; font-size: .68rem; font-weight: 700; background: var(--rs-subtle); color: var(--rs-text); border: 1px solid var(--rs-edge); }
html:root .ch-nombre { margin: 0 0 4px; font-size: .8rem; font-weight: 600; color: var(--rs-text); }
html:root .ch-bloque { border: 1px solid var(--rs-edge); box-shadow: none; }
html:root .ch-fila[data-de="tu"] .ch-bloque { background: var(--rs-primary-soft); border-color: var(--rs-primary-edge); color: var(--rs-ink); box-shadow: none; }
html:root .ch-burbuja { padding: 10px 14px; font-size: var(--ch-letra); font-weight: 400; line-height: 1.5; letter-spacing: 0; overflow-wrap: anywhere; word-break: break-word; }
html:root .ch-burbuja a, html:root .ch-t a { color: var(--rs-primary); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; word-break: break-all; }
html:root .ch-fila[data-de="tu"] .ch-burbuja a { color: var(--rs-ink); }
html:root .ch-meta { margin: 4px 2px 0; font-size: .78rem; font-weight: 500; color: var(--rs-text); }
html:root .is-leido .ch-visto path { stroke: var(--rs-primary); }
html:root .ch-fila.is-error .ch-meta { color: var(--rs-danger); }
html:root .ch-auto { font-size: .72rem; letter-spacing: .03em; color: var(--rs-text); opacity: 1; }

/* entrega: cartão em destaque */
html:root .ch-entrega { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; padding-bottom: 8px; border-bottom: 1px solid var(--rs-ok-edge); font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--rs-ok); }
html:root .ch-entrega::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--rs-ok); }
html:root .ch-bloque:has(.ch-entrega), html:root .ch-fila[data-de="tu"] .ch-bloque:has(.ch-entrega) { background: var(--rs-ok-soft); border: 1.5px solid var(--rs-ok-edge); color: var(--rs-ink); }
html:root .ch-bloque:has(.ch-entrega) a { color: var(--rs-primary); }

/* avisos do sistema: discretos */
html:root .ch-sistema { justify-content: center; margin: 14px auto 2px; max-width: 92%; padding: 6px 12px; border-radius: 8px; background: var(--rs-subtle); font-size: .82rem; line-height: 1.45; text-align: center; color: var(--rs-text); }
html:root .ch-sistema > span:last-child { overflow-wrap: anywhere; }

/* respostas rápidas: botões retos, sem pílula */
html:root .ch-fichas { margin-top: 14px; padding-left: 0; gap: 8px; }
html:root .ch-ficha { height: 40px; padding: 0 14px; border: 1.5px solid var(--rs-edge); border-radius: 10px; background: var(--rs-surface); font-size: .9rem; font-weight: 600; color: var(--rs-ink); transform: none; }
html:root .ch-ficha:hover { background: var(--rs-subtle); border-color: var(--rs-primary-edge); transform: none; }
html:root .ch-ficha--accion { border-color: var(--rs-primary-edge); color: var(--rs-primary); }
html:root .ch-ficha--accion::before { color: var(--rs-primary); }
html:root .ch-vuelo[data-forma="ficha"] { border-radius: 10px; }
html:root .ch-vuelo[data-forma="burbuja"] { border-radius: var(--ch-radio); }
html:root .ch-vuelo[data-forma="burbuja"] .ch-vuelo-fondo { box-shadow: none; border: 1px solid var(--rs-primary-edge); }
html:root .ch-vuelo-texto.is-tinta { color: var(--rs-ink); }

/* campo de mensagem fixo embaixo */
html:root .ch-redacta { padding: 12px 16px; border-top: 1.5px solid var(--rs-edge); background: var(--rs-surface); }
html:root .ch-redacta .ch-campo { max-width: 760px; margin: 0 auto; padding: 4px; border: 1.5px solid var(--rs-edge); border-radius: 10px; background: var(--rs-surface); }
html:root .ch-campo:focus-within { border-color: var(--rs-primary); box-shadow: 0 0 0 3px var(--rs-primary-soft); }
html:root .ch-campo textarea { padding: 9px 8px; font-size: var(--ch-letra); color: var(--rs-ink); }
html:root .ch-campo textarea::placeholder { color: var(--rs-muted); }
html:root .ch-adjunta, html:root .ch-envia { width: 40px; height: 40px; border-radius: 8px; }
html:root .ch-envia:disabled { background: var(--rs-subtle); color: var(--rs-muted); transform: none; }
html:root .ch-abajo { height: 36px; border-radius: 10px; border: 1.5px solid var(--rs-edge); font-weight: 600; color: var(--rs-ink); }

/* folha "Avaliar vendedor": sem amarelo, sem pílulas */
html:root .ch-hoja-fondo { background: rgba(10, 14, 20, .55); }
html:root .ch-hoja-panel { border-radius: 14px 14px 0 0; border-top: 1.5px solid var(--rs-edge); box-shadow: none; }
html:root .ch-hoja-cerrar { border-radius: 10px; }
html:root .ch-hoja-estrella { border-radius: 10px; }
html:root .ch-hoja-estrella.is-on { color: var(--rs-primary); }
html:root .ch-hoja-estrella.is-on svg { fill: var(--rs-primary); stroke: var(--rs-primary); }
html:root .ch-hoja-chip { border: 1.5px solid var(--rs-edge); border-radius: 10px; font-weight: 600; }
html:root .ch-hoja-texto { border: 1.5px solid var(--rs-edge); border-radius: 10px; }
html:root .ch-hoja-boton { border-radius: 10px; }
html:root .ch-hoja-error { color: var(--rs-danger); }

/* faixa lateral de conversas: quadrados arredondados, como os outros ícones da área */
html:root .ch-bub { border-radius: 12px; background: var(--rs-subtle); color: var(--rs-ink); border: 1.5px solid var(--rs-edge); }
html:root .ch-bub.is-active { background: var(--rs-primary-soft); color: var(--rs-primary); border-color: var(--rs-primary); box-shadow: none; }

/* carregando: spinner centralizado no corpo do chat */
html:root .ch-cargando .ch-pista { visibility: hidden; }
html:root .ch-cargando .ch-cuerpo::before { content: ""; position: absolute; left: 50%; top: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px; border: 3px solid var(--rs-edge); border-top-color: var(--rs-primary); border-radius: 50%; animation: ch-gira-carga .8s linear infinite; }
@keyframes ch-gira-carga { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { html:root .ch-cargando .ch-cuerpo::before { animation-duration: 2.4s; } }

@media (max-width: 560px) {
  html:root .ch-cabeza { padding: 8px 12px 8px 6px; }
  html:root .ch-hilo { padding: 0 12px 16px; }
  html:root .ch-msj, html:root .ch-fila[data-de="tu"] .ch-msj { max-width: 82%; }
  html:root .ch-fila:has(.ch-entrega) .ch-msj { max-width: 100%; }
  html:root .ch-fila:not([data-de="tu"]) { grid-template-columns: 28px minmax(0, 1fr); column-gap: 8px; }
  html:root .ch-av { width: 28px; height: 28px; }
  html:root .ch-redacta { padding: 10px 12px; }
  html:root .ch-status { padding: 3px 8px; }
  html:root .ch-fichas { padding: 2px 12px 4px; margin-top: 12px; }
}

/* ── ajustes pós-revisão: aviso de cookies, botão do vendedor, título em telas estreitas ── */
/* o aviso de cookies reserva espaço embaixo (--repo-consent-h, definido pelo consent.js): o chat encolhe em vez de ficar coberto */
@media (max-width: 900px) {
  html:root .ch-pagina { padding-bottom: var(--repo-consent-h, 0px); }
  html:root .ch-pagina .ch-charla { height: 100%; }
}
@media (min-width: 901px) {
  html:root .pd2 .ch-pagina .ch-charla, html:root .seller-sale-detail .ch-pagina .ch-charla { height: calc(100dvh - 215px - var(--repo-consent-h, 0px)); }
}
/* com o chat já aberto na página, o botão azul grande de abrir o chat sai */
html:root .seller-sale-detail:has(.ch-pagina) a[data-chat-open] { display: none; }
@media (max-width: 420px) {
  html:root .ch-quien h2 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: .95rem; line-height: 1.2; }
  html:root .ch-status { padding: 2px 7px; font-size: .72rem; }
}
@media (min-width: 901px) { html:root .pd2 .ch-pagina, html:root .seller-sale-detail .ch-pagina { background: none; } }
@media (min-width: 901px) { html:root .purchase-detail.pd2:has(.ch-pagina) { background: none; border-color: transparent; box-shadow: none; } }

/* ── campo de escrever sempre à vista (altura visível real) ──────────────────────────────
   --chat-vh / --chat-vt vêm do visualViewport (order-chat.js fitChat): descontam a barra do Safari e o teclado.
   --chat-h (computador) = o que sobra da janela abaixo do cabeçalho da página. Só o hilo rola; a página não. */
@media (max-width: 900px) {
  html:root .ch-pagina { top: var(--chat-vt, 0px); bottom: auto; height: var(--chat-vh, 100dvh); max-height: 100dvh; box-sizing: border-box; }
  @supports (height: 100svh) { html:root .ch-pagina { max-height: 100dvh; } }
  html:root .ch-redacta { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
}
@media (min-width: 901px) {
  html:root .pd2 .ch-pagina .ch-charla, html:root .seller-sale-detail .ch-pagina .ch-charla {
    height: calc(var(--chat-h, calc(100dvh - 215px)) - var(--repo-consent-h, 0px)); min-height: 260px; max-height: 100dvh;
  }
}
html:root .ch-charla { min-height: 0; }
html:root .ch-hilo { min-height: 0; overscroll-behavior: contain; }
