:root{
  --chat-red:#E30613;
  --chat-red-dark:#b00020;
  --chat-bg:#ffffff;
  --chat-soft:#f6f7f9;
  --chat-border:#e6e8ee;
  --chat-text:#222;
  --chat-muted:#666;
  --chat-shadow:0 16px 40px rgba(0,0,0,.14);
  --chat-radius:18px;
}

#iuChatWidget{
  position:fixed;
  right:20px;
  bottom:20px;
  z-index:9999;
  font-family:Arial,Helvetica,sans-serif;
}

#iuChatToggle{
  border:0;
  background:var(--chat-red);
  color:#fff;
  border-radius:999px;
  padding:14px 18px;
  font-size:14px;
  font-weight:800;
  cursor:pointer;
  box-shadow:0 14px 30px rgba(227,6,19,.28);
}

#iuChatToggle:hover{
  background:var(--chat-red-dark);
}

#iuChatPanel{
  width:min(390px, calc(100vw - 24px));
  height:min(620px, calc(100vh - 110px));
  margin-top:12px;
  display:none;
  flex-direction:column;
  overflow:hidden;
  background:var(--chat-bg);
  border:1px solid var(--chat-border);
  border-radius:var(--chat-radius);
  box-shadow:var(--chat-shadow);
}

#iuChatPanel.is-open{
  display:flex;
}

.iu-chat-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  background:linear-gradient(180deg, #fff 0%, #fff5f6 100%);
  border-bottom:1px solid var(--chat-border);
}

.iu-chat-header h3{
  margin:0;
  font-size:16px;
  color:var(--chat-red);
}

.iu-chat-header p{
  margin:4px 0 0;
  font-size:12px;
  line-height:1.4;
  color:var(--chat-muted);
}

#iuChatClose{
  width:32px;
  height:32px;
  border:0;
  border-radius:999px;
  background:#fff;
  color:var(--chat-text);
  cursor:pointer;
  font-size:18px;
  line-height:1;
  box-shadow:0 2px 8px rgba(0,0,0,.06);
}

#iuChatMessages{
  flex:1 1 auto;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:14px;
  background:var(--chat-soft);
}

.iu-msg{
  max-width:86%;
  padding:11px 13px;
  border-radius:14px;
  font-size:14px;
  line-height:1.45;
  white-space:pre-wrap;
  word-break:break-word;
}

.iu-msg.user{
  align-self:flex-end;
  background:var(--chat-red);
  color:#fff;
  border-bottom-right-radius:6px;
}

.iu-msg.assistant{
  align-self:flex-start;
  background:#fff;
  color:var(--chat-text);
  border:1px solid var(--chat-border);
  border-bottom-left-radius:6px;
}

.iu-msg.system{
  align-self:center;
  max-width:100%;
  background:#fff7e8;
  color:#8a5a00;
  border:1px solid #f0d8a8;
  font-size:12px;
}

.iu-chat-footer{
  padding:12px;
  background:#fff;
  border-top:1px solid var(--chat-border);
}

#iuChatForm{
  display:flex;
  align-items:flex-end;
  gap:8px;
}

#iuChatInput{
  flex:1 1 auto;
  resize:none;
  min-height:44px;
  max-height:120px;
  padding:11px 12px;
  border:1px solid var(--chat-border);
  border-radius:14px;
  outline:none;
  font-size:14px;
  line-height:1.4;
  font-family:Arial,Helvetica,sans-serif;
}

#iuChatInput:focus{
  border-color:#d8b3bb;
  box-shadow:0 0 0 3px rgba(227,6,19,.08);
}

#iuChatSend{
  min-width:76px;
  padding:12px 14px;
  border:0;
  border-radius:14px;
  background:var(--chat-red);
  color:#fff;
  cursor:pointer;
  font-size:13px;
  font-weight:800;
}

#iuChatSend:hover{
  background:var(--chat-red-dark);
}

#iuChatSend:disabled{
  opacity:.6;
  cursor:not-allowed;
}

.iu-chat-note{
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid var(--chat-border);
  font-size:12px;
  line-height:1.4;
  color:var(--chat-muted);
}

.chat-info-texto{
  margin:0 0 10px 0;
  font-size:13px;
  line-height:1.45;
  color:#555;
}

.chat-info-texto a{
  color:var(--chat-red);
  font-weight:600;
  text-decoration:none;
}

.chat-info-texto a:hover{
  text-decoration:underline;
}

.iu-contact-actions{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:8px;
}

.iu-contact-btn{
  padding:8px 12px;
  border:1px solid var(--chat-red);
  border-radius:8px;
  background:#fff;
  color:var(--chat-red);
  cursor:pointer;
  font-size:13px;
  font-weight:600;
  transition:all .2s ease;
}

.iu-contact-btn:hover{
  background:var(--chat-red);
  color:#fff;
}

.iu-contact-btn:disabled{
  opacity:.5;
  cursor:not-allowed;
  background:#f5f5f5;
  color:#999;
  border-color:#ccc;
}

.iu-human-chat-status{
  min-height:18px;
  margin-top:4px;
  font-size:12px;
  line-height:1.35;
  color:#666;
}

.iu-human-chat-status.online{
  color:#127a2f;
  font-weight:600;
}

.iu-human-chat-status.waiting{
  color:#9a6700;
  font-weight:600;
}

.iu-human-chat-status.offline{
  color:#b42318;
  font-weight:600;
}

.iu-chat-typing{
  display:inline-flex;
  align-items:center;
  gap:4px;
}

.iu-chat-dot{
  width:6px;
  height:6px;
  border-radius:999px;
  background:#c44;
  animation:iuChatBlink 1.2s infinite ease-in-out;
}

.iu-chat-dot:nth-child(2){
  animation-delay:.15s;
}

.iu-chat-dot:nth-child(3){
  animation-delay:.3s;
}

@keyframes iuChatBlink{
  0%, 80%, 100%{
    opacity:.28;
    transform:scale(.9);
  }
  40%{
    opacity:1;
    transform:scale(1);
  }
}

@media (max-width:640px){
  #iuChatWidget{
    right:12px;
    left:12px;
    bottom:12px;
  }

  #iuChatToggle{
    width:100%;
  }

  #iuChatPanel{
    width:100%;
    height:min(70vh, 620px);
  }

  .iu-contact-actions{
    display:grid;
    grid-template-columns:1fr;
  }

  .iu-contact-btn{
    width:100%;
    text-align:center;
  }
}