.mpc-widget,
.mpc-widget * {
  box-sizing: border-box;
}

.mpc-widget {
  width: 100%;
  max-width: 760px;
  margin: 18px auto;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 20px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 14px 40px rgba(17, 24, 39, 0.08);
  font-family: inherit;
  color: #111827;
}

.mpc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #0f172a, #1f2937);
  color: #fff;
}

.mpc-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.mpc-subtitle {
  font-size: 13px;
  opacity: 0.86;
  line-height: 1.5;
}

.mpc-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.12);
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.mpc-status span {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.2);
}

.mpc-note {
  margin: 12px 14px 0;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  color: #475569;
  font-size: 12px;
  line-height: 1.55;
}

.mpc-name-row {
  padding: 12px 14px 0;
}

.mpc-name {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 11px 12px;
  outline: none;
  background: #fff;
}

.mpc-name:focus,
.mpc-input:focus {
  border-color: #94a3b8;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.16);
}

.mpc-quick-prompts {
  display: flex;
  gap: 8px;
  padding: 12px 14px 0;
  flex-wrap: wrap;
}

.mpc-quick-prompts button {
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #111827;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.18s ease;
}

.mpc-quick-prompts button:hover {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.mpc-messages {
  height: var(--mpc-height, 520px);
  overflow-y: auto;
  padding: 16px 14px;
  scroll-behavior: smooth;
  background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.06), transparent 30%), #fff;
}

.mpc-msg {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  align-items: flex-start;
}

.mpc-msg.mpc-user {
  flex-direction: row-reverse;
}

.mpc-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-weight: 800;
  background: #e0f2fe;
  color: #075985;
}

.mpc-user .mpc-avatar {
  background: #dcfce7;
  color: #166534;
}

.mpc-bubble {
  max-width: 78%;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 16px 16px 16px 5px;
  padding: 10px 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.mpc-user .mpc-bubble {
  background: #f0fdf4;
  border-color: #bbf7d0;
  border-radius: 16px 16px 5px 16px;
}

.mpc-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  color: #475569;
  font-size: 11px;
  margin-bottom: 5px;
}

.mpc-meta strong {
  color: #111827;
  font-size: 12px;
}

.mpc-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 7px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 700;
}

.mpc-badge.virtual {
  background: #eef2ff;
  color: #4338ca;
}

.mpc-badge.real {
  background: #dcfce7;
  color: #15803d;
}

.mpc-time {
  opacity: 0.7;
}

.mpc-text {
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 14px;
}

.mpc-form {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 12px 14px 14px;
  border-top: 1px solid #eef2f7;
  background: #fff;
}

.mpc-input {
  resize: none;
  width: 100%;
  min-height: 48px;
  max-height: 120px;
  border: 1px solid #e5e7eb;
  border-radius: 15px;
  padding: 12px;
  outline: none;
  line-height: 1.5;
}

.mpc-send {
  flex: 0 0 auto;
  min-width: 92px;
  border: 0;
  border-radius: 15px;
  background: #111827;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  padding: 0 16px;
  transition: 0.18s ease;
}

.mpc-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.18);
}

.mpc-send:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.mpc-foot {
  padding: 0 14px 14px;
  color: #64748b;
  font-size: 11px;
}

.mpc-loading,
.mpc-error,
.mpc-empty,
.mpc-system {
  text-align: center;
  padding: 18px;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  line-height: 1.6;
}

.mpc-empty-title {
  color: #111827;
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 5px;
}

.mpc-system {
  padding: 10px;
  font-size: 12px;
  margin: 8px 0;
}

@media (max-width: 640px) {
  .mpc-widget {
    border-radius: 16px;
    margin: 14px 0;
  }
  .mpc-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .mpc-messages {
    height: 430px;
  }
  .mpc-bubble {
    max-width: 86%;
  }
  .mpc-form {
    gap: 8px;
  }
  .mpc-send {
    min-width: 76px;
    padding: 0 12px;
  }
}

.mpc-hide-role-badges .mpc-badge {
  display: none !important;
}

.mpc-typing-bubble {
  min-width: 96px;
}

.mpc-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}

.mpc-typing span {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
  background: #94a3b8;
  animation: mpcTypingDot 1s infinite ease-in-out;
}

.mpc-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.mpc-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes mpcTypingDot {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}
