/* Xima Recepción · widget de chat embebible
   Reset acotado y namespace .xima-* para evitar colisiones con el host. */

.xima-launcher,
.xima-panel,
.xima-panel * {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.xima-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--xima-primary, #d97706);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  transition: transform 0.15s ease;
}
.xima-launcher:hover { transform: scale(1.05); }

.xima-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: min(600px, calc(100vh - 120px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  z-index: 2147483647;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.xima-panel.open { display: flex; }

.xima-header {
  background: var(--xima-primary, #d97706);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.xima-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.xima-header .xima-subtitle { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.xima-close {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
}

.xima-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fafafa;
}

.xima-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.xima-msg.assistant {
  align-self: flex-start;
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}
.xima-msg.user {
  align-self: flex-end;
  background: var(--xima-primary, #d97706);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.xima-msg.system {
  align-self: center;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  max-width: 95%;
}
.xima-msg.error {
  align-self: center;
  background: #fee2e2;
  color: #991b1b;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  max-width: 95%;
}

.xima-typing {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.xima-typing span {
  display: block;
  width: 7px;
  height: 7px;
  background: #9ca3af;
  border-radius: 50%;
  animation: xima-bounce 1.2s infinite ease-in-out;
}
.xima-typing span:nth-child(2) { animation-delay: 0.15s; }
.xima-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes xima-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.6; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.xima-input-wrap {
  border-top: 1px solid #e5e7eb;
  padding: 10px;
  background: #fff;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.xima-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  resize: none;
  max-height: 120px;
  min-height: 40px;
  outline: none;
  font-family: inherit;
}
.xima-input:focus { border-color: var(--xima-primary, #d97706); }
.xima-send {
  background: var(--xima-primary, #d97706);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0 14px;
  height: 40px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.xima-send:disabled { opacity: 0.5; cursor: not-allowed; }

.xima-footer {
  font-size: 11px;
  color: #6b7280;
  text-align: center;
  padding: 6px;
  background: #fff;
  border-top: 1px solid #f3f4f6;
}
