:root {
  --papel: #f3e6d6; --claro: #fcf3ea; --tinta: #0a0907; --suave: #5b524b; --marca: #cf4520; --linea: #e2d3c0;
  --radio: 18px; --sombra: 0 1px 0 rgba(10, 9, 7, .04), 0 6px 18px rgba(10, 9, 7, .06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--papel); color: var(--tinta); font: 400 17px/1.45 'Archivo', system-ui, sans-serif;
  display: flex; flex-direction: column; min-height: 100dvh; }
[hidden] { display: none !important; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.barra { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top)); background: var(--tinta); color: var(--claro); }
.logo { width: 42px; height: 42px; padding: 4px; background: var(--claro); border-radius: 12px; }
.titulo { display: flex; flex-direction: column; line-height: 1.1; }
.titulo small { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.titulo strong { font-size: 20px; font-weight: 800; font-stretch: 112%; }
.salir { margin-left: auto; background: transparent; color: var(--claro); border: 1px solid rgba(252, 243, 234, .35);
  border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px; cursor: pointer; }

/* entrar */
.entrar { width: 100%; max-width: 520px; margin: 0 auto; padding: 24px 16px; }
.tarjeta { background: var(--claro); border-radius: var(--radio); padding: 20px; box-shadow: var(--sombra); }
h1 { margin: 0 0 6px; font-size: 28px; font-weight: 800; font-stretch: 112%; }
p { margin: 0 0 14px; color: var(--suave); }
label { display: block; font-weight: 600; margin: 4px 0 6px; }
input[type=password], textarea { width: 100%; font: inherit; color: var(--tinta); background: #fff;
  border: 1.5px solid var(--linea); border-radius: 14px; padding: 12px 14px; }
input:focus, textarea:focus { outline: none; border-color: var(--marca); box-shadow: 0 0 0 3px rgba(207, 69, 32, .15); }
.boton { margin-top: 12px; background: var(--marca); color: #fff; border: 0; border-radius: 999px; padding: 12px 22px;
  font: inherit; font-weight: 700; cursor: pointer; }
.error { color: #b3261e; margin: 6px 0 0; font-size: 15px; }
.error:empty { display: none; }
.pie { text-align: center; padding: 20px 16px; font-size: 14px; color: var(--suave); }
.pie a { color: var(--tinta); font-weight: 700; }

/* chat */
.chat { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 720px; margin: 0 auto; min-height: 0; }
.mensajes { list-style: none; margin: 0; padding: 16px 12px 8px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.msj { max-width: 85%; padding: 10px 14px; border-radius: var(--radio); box-shadow: var(--sombra); }
.msj.yo { align-self: flex-end; background: var(--tinta); color: var(--claro); border-bottom-right-radius: 6px; }
.msj.claudio { align-self: flex-start; background: var(--claro); border-bottom-left-radius: 6px; }
.msj .quien { display: block; font-size: 12px; font-weight: 700; color: var(--marca); margin-bottom: 2px; }
.msj .texto { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; color: inherit; }
.msj .texto a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msj.claudio .texto a { color: var(--marca); }
.msj .hora { display: block; font-size: 11px; opacity: .6; margin-top: 4px; text-align: right; }
.msj .fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; margin-bottom: 6px; }
.msj .fotos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: rgba(252, 243, 234, .15); cursor: zoom-in; }
.msj .video, .msj .adj-img { display: block; width: 100%; max-width: 420px; border-radius: 12px; margin: 4px 0 8px; background: var(--tinta); }
.msj .adj-img { cursor: zoom-in; }
.msj .archivo { display: inline-block; margin: 4px 0 8px; padding: 8px 12px; border-radius: 10px; background: #fff;
  color: var(--tinta); font-weight: 700; text-decoration: none; border: 1px solid var(--linea); }
.escribiendo { align-self: flex-start; display: flex; gap: 6px; align-items: center; padding: 12px 16px; background: var(--claro);
  border-radius: var(--radio); border-bottom-left-radius: 6px; font-size: 14px; color: var(--suave); box-shadow: var(--sombra); }
.escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: var(--marca); animation: latido 1.4s ease-in-out infinite; }
.escribiendo i:nth-child(2) { animation-delay: .2s; } .escribiendo i:nth-child(3) { animation-delay: .4s; }
@keyframes latido { 50% { opacity: .2; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .escribiendo i { animation: none; } }

.escribir { position: sticky; bottom: 0; z-index: 2; background: var(--papel); padding: 8px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--linea); }
.escribir .fila { display: flex; align-items: flex-end; gap: 8px; }
.escribir textarea { resize: none; min-height: 46px; max-height: 160px; border-radius: 22px; padding: 11px 16px; }
.clip, .enviar { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; margin: 0; }
.clip { background: var(--claro); color: var(--tinta); border: 1.5px solid var(--linea); }
.clip input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.clip:focus-within { border-color: var(--marca); }
.enviar { background: var(--marca); color: #fff; border: 0; }
.enviar:disabled { opacity: .55; cursor: default; }
.clip svg, .enviar svg { width: 24px; height: 24px; }
.adjuntos { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; }
.adjunto { position: relative; flex: none; width: 72px; height: 72px; }
.adjunto img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.adjunto button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: var(--tinta); color: var(--claro); font: 700 14px/1 system-ui; cursor: pointer; }

.visor { position: fixed; inset: 0; z-index: 10; background: rgba(10, 9, 7, .9); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.visor img { max-width: 100%; max-height: 100%; border-radius: 12px; }
