/* Portada pública de Multiwin (diseño aprobado 17/11).
   CSP del portal: sin inline, todo el estilo vive acá. */
:root{
  --wa-header:#008069;
  --wa-bg:#efeae2;
  --wa-in:#ffffff;
  --wa-out:#d9fdd3;
  --wa-text:#111b21;
  --wa-meta:#667781;
  --wa-blue:#53bdeb;
  --wa-bar:#f0f2f5;
  --wa-green:#008069;
  --font:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  background:#0b0406;
  color:var(--wa-text);
  overscroll-behavior:none;
}

.shell{
  display:flex;
  flex-direction:column;
  width:100%;
  max-width:440px;
  margin:0 auto;
  min-height:100dvh;
  background:#140508 url("img/fondo.jpg") center top / cover no-repeat;
  position:relative;
  overflow:hidden;
}

/* ---------- Cabecera con el logo ---------- */
.brand{
  position:relative;
  display:grid;
  place-items:center;
  padding:10px 12px 6px;
  background:linear-gradient(180deg,rgba(8,2,4,.75),rgba(8,2,4,.25) 72%,rgba(8,2,4,0));
  flex:0 0 auto;
}
.brand img{
  display:block;
  height:clamp(75px,19.5vw,107px);
  width:auto;
  max-width:66%;
  filter:drop-shadow(0 8px 16px rgba(0,0,0,.8));
}

/* ---------- Entrar / Crear cuenta ---------- */
.gate{
  display:flex;
  gap:8px;
  justify-content:center;
  padding:0 12px 8px;
  flex:0 0 auto;
}
.gate .btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:40px;
  padding:7px 18px;
  border-radius:999px;
  background:linear-gradient(160deg,#ffe9a8,#e0a52c 55%,#a9720f);
  color:#3a1206;
  font-size:14.5px;
  font-weight:700;
  text-decoration:none;
  box-shadow:0 10px 20px -14px rgba(0,0,0,.9);
}
.gate .btn.ghost{
  background:rgba(255,255,255,.14);
  color:#fff;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.35);
}
.gate .btn:active{filter:brightness(.96)}

/* ---------- Panel de información (aparece al minimizar el chat) ---------- */
.info{
  display:none;
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  padding:2px 14px 10px;
  animation:pop .18s ease-out;
}
.shell.chat-min .info{display:block}
.info .panel{
  background:rgba(255,255,255,.97);
  border:1px solid rgba(0,0,0,.10);
  border-radius:14px;
  padding:12px 14px;
  margin:0 0 10px;
  box-shadow:0 18px 30px -24px rgba(0,0,0,.95);
}
.info h2{
  margin:0 0 7px;
  font-size:12px;
  letter-spacing:.07em;
  text-transform:uppercase;
  color:#00725e;
}
.info p,
.info li{font-size:13.8px;line-height:1.45;margin:0 0 6px;color:#1f2a30}
.info p:last-child,
.info li:last-child{margin-bottom:0}
/* El texto de las tarjetas viene de la base (panel → Tarjetas web):
   los saltos de línea se respetan tal cual. */
.info .body{white-space:pre-line}
.info .back{
  display:flex;align-items:center;justify-content:center;gap:7px;
  width:100%;min-height:44px;margin:2px 0 2px;
  border:0;border-radius:12px;
  background:linear-gradient(160deg,#ffe9a8,#e0a52c 55%,#a9720f);
  color:#3a1206;font-family:inherit;font-size:14.5px;font-weight:700;
  cursor:pointer;box-shadow:0 10px 20px -14px rgba(0,0,0,.9);
}
.info .back:active{filter:brightness(.96)}

/* ---------- Ventana del chat ---------- */
.chat{
  display:flex;
  flex-direction:column;
  flex:1 1 auto;
  min-height:0;
  margin:6px 12px 12px;
  border:1px solid rgba(255,255,255,.3);
  border-radius:18px;
  overflow:hidden;
  background:var(--wa-bg);
  box-shadow:0 20px 38px -20px rgba(0,0,0,.9), 0 0 0 4px rgba(0,0,0,.22);
}

.chatbar{
  display:flex;
  align-items:center;
  gap:8px;
  flex:0 0 auto;
  min-height:56px;
  padding:8px 12px;
  background:var(--wa-header);
  color:#fff;
  border-bottom:1px solid rgba(0,0,0,.12);
  box-shadow:0 1px 3px rgba(0,0,0,.18);
}
.icon{display:block;flex:0 0 auto}

/* ---------- Chat minimizado ---------- */
.shell.chat-min .chat{flex:0 0 auto}
.shell.chat-min .thread,
.shell.chat-min .composer{display:none}
.shell.chat-min .chatbar{border-bottom:0;cursor:pointer;padding-right:8px}
.shell.chat-min .chatbar:hover{filter:brightness(1.04)}

.toggle{
  flex:0 0 auto;
  width:36px;height:36px;border:0;border-radius:50%;
  display:grid;place-items:center;
  background:rgba(255,255,255,.16);color:#fff;
  cursor:pointer;
}
.toggle:active{background:rgba(255,255,255,.28)}
.toggle .ico-open,
.shell.chat-min .toggle .ico-min{display:none}
.shell.chat-min .toggle .ico-open{display:block}
.who{display:flex;align-items:center;gap:9px;min-width:0;flex:1 1 auto;padding:2px 0;border:0;background:none;color:inherit;text-align:left}
.avatar{
  width:38px;height:38px;border-radius:50%;
  display:grid;place-items:center;
  background:linear-gradient(160deg,#ffe9a8,#e0a52c 55%,#a9720f);
  color:#3a1206;font-weight:800;font-size:15px;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.35);
  flex:0 0 auto;
}
.who b{display:block;font-size:16px;font-weight:600;line-height:1.2;letter-spacing:.01em}
.who small{display:block;font-size:12.5px;opacity:.9;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* ---------- Hilo ---------- */
.thread{
  position:relative;
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  padding:10px 8px 12px;
  background-color:var(--wa-bg);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='130' height='130' viewBox='0 0 130 130'%3E%3Cg fill='none' stroke='%23d7cfc0' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round' opacity='.65'%3E%3Ccircle cx='22' cy='24' r='5'/%3E%3Cpath d='M48 16c7 0 7 11 0 11s-7-11 0-11'/%3E%3Cpath d='M92 20l6 6-6 6-6-6z'/%3E%3Cpath d='M16 72c9-7 15 7 4 11'/%3E%3Cpath d='M64 60h15v11H64z'/%3E%3Cpath d='M104 68c0 9-11 9-11 0'/%3E%3Cpath d='M32 108c7-5 13 3 6 9'/%3E%3Cpath d='M78 102l4 9h-8z'/%3E%3Cpath d='M110 104h12v8h-12z'/%3E%3C/g%3E%3C/svg%3E");
}
.chip-date,
.chip-enc{
  display:block;
  width:max-content;
  max-width:88%;
  margin:6px auto 10px;
  padding:5px 12px;
  border-radius:7px;
  font-size:11.5px;
  line-height:1.35;
  text-align:center;
  color:#6b5b45;
  box-shadow:0 1px 0 rgba(11,20,26,.08);
}
.chip-date{background:#e1f2fa;text-transform:uppercase;letter-spacing:.04em;font-weight:500}
.chip-enc{
  display:flex;align-items:center;justify-content:center;gap:5px;
  background:#fdf3c6;margin-bottom:12px;
}
.chip-enc svg{flex:0 0 auto;opacity:.75}

.msg{display:flex;margin-bottom:6px;animation:pop .16s ease-out}
.msg.in{justify-content:flex-start}
.msg.out{justify-content:flex-end}
@keyframes pop{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}

.bubble{
  position:relative;
  max-width:82%;
  padding:5px 8px 6px;
  border-radius:8px;
  font-size:14.2px;
  line-height:1.36;
  color:var(--wa-text);
  overflow-wrap:anywhere;
  box-shadow:0 1px .5px rgba(11,20,26,.13);
}
.in .bubble{background:var(--wa-in);border-top-left-radius:0}
.out .bubble{background:var(--wa-out);border-top-right-radius:0}

.in .bubble::before,
.out .bubble::before{
  content:"";position:absolute;top:0;width:0;height:0;
  border-top:12px solid var(--wa-in);
}
.in .bubble::before{left:-8px;border-left:8px solid transparent}
.out .bubble::before{right:-8px;border-right:8px solid transparent;border-top-color:var(--wa-out)}

.bubble p{margin:0;padding-right:2px}
.stamp{
  display:inline-flex;align-items:center;gap:3px;
  float:right;
  margin:2px -2px -2px 8px;
  font-size:11px;line-height:15px;color:var(--wa-meta);
  white-space:nowrap;
}
.stamp svg{color:var(--wa-blue)}

/* botones de respuesta rápida */
.menu{margin-top:6px;display:grid;gap:6px;width:min(78vw,268px)}
.menu button{
  display:flex;align-items:center;justify-content:center;gap:6px;
  min-height:40px;padding:7px 10px;
  border:1px solid #d1d7db;border-radius:7px;
  background:#fff;color:#00a884;
  font-family:inherit;font-size:14px;font-weight:500;
  cursor:pointer;
}
.menu button:active{background:#f0f2f5}

.typing .bubble{padding:10px 12px}
.dots{display:inline-flex;gap:4px;align-items:center}
.dots i{width:7px;height:7px;border-radius:50%;background:#9aa8af;animation:bounce 1.2s infinite ease-in-out}
.dots i:nth-child(2){animation-delay:.15s}
.dots i:nth-child(3){animation-delay:.3s}
@keyframes bounce{0%,60%,100%{transform:translateY(0);opacity:.55}30%{transform:translateY(-4px);opacity:1}}

/* ---------- Composer ---------- */
.composer{
  display:flex;align-items:flex-end;gap:5px;
  flex:0 0 auto;
  padding:5px 6px calc(6px + env(safe-area-inset-bottom));
  background:var(--wa-bar);
}
.field{
  flex:1 1 auto;min-width:0;
  display:flex;align-items:center;gap:2px;
  background:#fff;border-radius:22px;
  padding:2px 4px 2px 14px;
  min-height:44px;
  box-shadow:0 1px 1px rgba(11,20,26,.1);
}
.field input{
  flex:1 1 auto;min-width:0;height:40px;
  border:0;outline:0;background:transparent;
  font-family:inherit;font-size:15px;color:var(--wa-text);
}
.field input::placeholder{color:#9a8b7c}
.send{
  width:46px;height:46px;flex:0 0 auto;border:0;border-radius:50%;
  background:var(--wa-green);color:#fff;
  display:grid;place-items:center;cursor:pointer;
  box-shadow:0 2px 6px -2px rgba(122,74,6,.6);
}
.send:active{filter:brightness(.95)}

:focus-visible{outline:2px solid #25d366;outline-offset:2px;border-radius:4px}

@media (min-width:700px){
  body{background:#0b0406;display:flex;align-items:center;justify-content:center;padding:20px 0}
  .shell{min-height:min(860px,calc(100dvh - 40px));height:min(860px,calc(100dvh - 40px));border-radius:16px;box-shadow:0 30px 70px -30px #000}
}
@media (prefers-reduced-motion:reduce){
  .msg{animation:none}
  .dots i{animation:none;opacity:.7}
}
